@Override
    public final Enumeration<byte[]> getIds() {
        // Make a copy of the IDs.
        final Iterator<NativeSslSession> iter;
        synchronized (sessions) {
            iter = Arrays.asList(sessions.values().toArray(new NativeSslSession[0]))
                    .iterator();
        }
        return new Enumeration<byte[]>() {
            private NativeSslSession next;

            @Override
            public boolean hasMoreElements() {
                if (next != null) {
                    return true;
                }
                while (iter.hasNext()) {
                    NativeSslSession session = iter.next();
                    if (session.isValid()) {
                        next = session;
                        return true;
                    }
                }
                next = null;
                return false;
            }

            @Override
            public byte[] nextElement() {
                if (hasMoreElements()) {
                    byte[] id = next.getId();
                    next = null;
                    return id;
                }
                throw new NoSuchElementException();
            }
        };
    }
This method is provided for API-compatibility only, not intended for use. No guarantees
are made WRT performance.
common/src/main/java/org/conscrypt/AbstractSessionContext.java