Code example for Iterator

Methods: hasNextnext

0
        assertTrue(keySet.containsAll(Arrays.asList("first", "second")));
        assertFalse(keySet.containsAll(Arrays.asList("first", "notFound")));
 
        Iterator<String> iter = keySet.iterator();
 
        assertTrue(iter.hasNext());
        assertEquals("_id", iter.next());
        assertTrue(iter.hasNext());
        assertEquals("first", iter.next());
        assertTrue(iter.hasNext());
        assertEquals("second", iter.next());
        assertTrue(iter.hasNext());
        assertEquals("third", iter.next());
        assertTrue(iter.hasNext());
        assertEquals("fourth", iter.next());
        assertFalse(iter.hasNext());
 
        assertEquals(obj.get("_id"), lazyDBObj.get("_id"));
        assertEquals(obj.get("first"), lazyDBObj.get("first"));
        assertEquals(obj.get("second"), lazyDBObj.get("second"));
        assertEquals(obj.get("third"), lazyDBObj.get("third"));
Contextual code suggestions in your IDE  Get Codota for Java