/** * Returns {@code true} if this map contains no key-value mappings. * * @return {@code true} if this map contains no key-value mappings. */ public boolean isEmpty() { return (size() <= 0); }
/** * Returns {@code true} if this map contains no key-value mappings. * * @return {@code true} if this map contains no key-value mappings. */ public boolean isEmpty() { return (size() <= 0); }
/** * Returns {@code true} if this map contains no key-value mappings. * * @return {@code true} if this map contains no key-value mappings. */ public boolean isEmpty() { return (size() <= 0); }
/** * Returns {@code true} if this map contains no key-value mappings. * * @return {@code true} if this map contains no key-value mappings. */ public boolean isEmpty() { return (size() <= 0); }
/** * Method testTimeoutIsEmpty */ @Test public void testTimeoutIsEmpty() { TimeoutMap map = new TimeoutMap(50L); assertNull(map.put("key", "value-1")); assertEquals("value-1", map.get("key")); assertNull(map.put("another", "value-2")); assertEquals("value-2", map.get("another")); synchronized (this) { try { Thread.sleep(100L); } catch (InterruptedException e) { // Continue, but might break the timeout thing below... } } // This for loop should not print anything, if the tests succeed. Set set = map.keySet(); assertEquals(0, set.size()); for (Iterator iterator = set.iterator(); iterator.hasNext(); System.out.println(iterator.next())) { ; } assertEquals(0, map.size()); assertTrue(map.isEmpty()); }
/** * Method testTimeoutIsEmpty */ public void testTimeoutIsEmpty() { TimeoutMap map = new TimeoutMap(50L); assertNull(map.put("key", "value-1")); assertEquals("value-1", map.get("key")); assertNull(map.put("another", "value-2")); assertEquals("value-2", map.get("another")); synchronized (this) { try { Thread.sleep(100L); } catch (InterruptedException e) { // Continue, but might break the timeout thing below... } } // This for loop should not print anything, if the tests succeed. Set set = map.keySet(); assertEquals(0, set.size()); for (Iterator iterator = set.iterator(); iterator.hasNext(); System.out.println(iterator.next())) { ; } assertEquals(0, map.size()); assertTrue(map.isEmpty()); }
/** * Method testTimeoutIsEmpty */ public void testTimeoutIsEmpty() { TimeoutMap map = new TimeoutMap(50L); assertNull(map.put("key", "value-1")); assertEquals("value-1", map.get("key")); assertNull(map.put("another", "value-2")); assertEquals("value-2", map.get("another")); synchronized (this) { try { Thread.sleep(100L); } catch (InterruptedException e) { // Continue, but might break the timeout thing below... } } // This for loop should not print anything, if the tests succeed. Set set = map.keySet(); assertEquals(0, set.size()); for (Iterator iterator = set.iterator(); iterator.hasNext(); System.out.println(iterator.next())) { ; } assertEquals(0, map.size()); assertTrue(map.isEmpty()); }
/** * Method testTimeoutIsEmpty */ @Test public void testTimeoutIsEmpty() { TimeoutMap map = new TimeoutMap(50L); assertNull(map.put("key", "value-1")); assertEquals("value-1", map.get("key")); assertNull(map.put("another", "value-2")); assertEquals("value-2", map.get("another")); synchronized (this) { try { Thread.sleep(100L); } catch (InterruptedException e) { // Continue, but might break the timeout thing below... } } // This for loop should not print anything, if the tests succeed. Set set = map.keySet(); assertEquals(0, set.size()); for (Iterator iterator = set.iterator(); iterator.hasNext(); System.out.println(iterator.next())) { ; } assertEquals(0, map.size()); assertTrue(map.isEmpty()); }