@Test public void testHasState() { StateObjectCollection<StateObject> stateObjects = new StateObjectCollection<>(new ArrayList<>()); Assert.assertFalse(stateObjects.hasState()); stateObjects = new StateObjectCollection<>(Collections.singletonList(null)); Assert.assertFalse(stateObjects.hasState()); stateObjects = new StateObjectCollection<>(Collections.singletonList(mock(StateObject.class))); Assert.assertTrue(stateObjects.hasState()); }
public boolean hasState() { for (StateObject state : stateObjects) { if (state != null) { return true; } } return false; }
StateObjectCollection implements Collection<T>, StateObject { public boolean hasState() { for (StateObject state : stateObjects) { if (state != null) { return true; } } return false; } }
StateObjectCollection implements Collection<T>, StateObject { public boolean hasState() { for (StateObject state : stateObjects) { if (state != null) { return true; } } return false; } StateObjectCollection();  StateObjectCollection(Collection<T> stateObjects); }
StateObjectCollection implements Collection<T>, StateObject { public boolean hasState() { for (StateObject state : stateObjects) { if (state != null) { return true; } } return false; } StateObjectCollection();  StateObjectCollection(Collection<T> stateObjects); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<T> iterator(); @Override Object[] toArray(); @Override T1[] toArray(T1[] a); @Override boolean add(T t); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends T> c); @Override boolean removeAll(Collection<?> c); @Override boolean removeIf(Predicate<? super T> filter); @Override boolean retainAll(Collection<?> c); @Override void clear(); @Override void discardState(); @Override long getStateSize(); boolean hasState(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); List<T> asList(); static StateObjectCollection<T> empty(); static StateObjectCollection<T> singleton(T stateObject); }
StateObjectCollection implements Collection<T>, StateObject { public boolean hasState() { for (StateObject state : stateObjects) { if (state != null) { return true; } } return false; } StateObjectCollection();  StateObjectCollection(Collection<T> stateObjects); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override Iterator<T> iterator(); @Override Object[] toArray(); @Override T1[] toArray(T1[] a); @Override boolean add(T t); @Override boolean remove(Object o); @Override boolean containsAll(Collection<?> c); @Override boolean addAll(Collection<? extends T> c); @Override boolean removeAll(Collection<?> c); @Override boolean removeIf(Predicate<? super T> filter); @Override boolean retainAll(Collection<?> c); @Override void clear(); @Override void discardState(); @Override long getStateSize(); boolean hasState(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); List<T> asList(); static StateObjectCollection<T> empty(); static StateObjectCollection<T> singleton(T stateObject);  }