@Test public void testEntityCollectionContainsRefString() { Entity e1 = mock(Entity.class); when(e1.getReference()).thenReturn("/ref/e1"); Entity e2 = mock(Entity.class); when(e2.getReference()).thenReturn("/ref/e2"); assertTrue(entityCollectionContainsRefString( Arrays.asList(new Entity[] { e1, e2 }), "/ref/e1")); assertFalse(entityCollectionContainsRefString( Arrays.asList(new Entity[] { e1, e2 }), "/ref/missing")); assertFalse(entityCollectionContainsRefString( Arrays.asList(new Entity[] {}), "/ref/e1")); }
public static boolean entityCollectionContainsRefString(Collection<Entity> entities, String entityRef) { for (Iterator<Entity> i = entities.iterator(); i.hasNext();) { Entity entity = i.next(); if (entity.getReference().equals(entityRef)) return true; } return false; }
EntityCollections { public static boolean entityCollectionContainsRefString(Collection<Entity> entities, String entityRef) { for (Iterator<Entity> i = entities.iterator(); i.hasNext();) { Entity entity = i.next(); if (entity.getReference().equals(entityRef)) return true; } return false; } }
EntityCollections { public static boolean entityCollectionContainsRefString(Collection<Entity> entities, String entityRef) { for (Iterator<Entity> i = entities.iterator(); i.hasNext();) { Entity entity = i.next(); if (entity.getReference().equals(entityRef)) return true; } return false; }  }
EntityCollections { public static boolean entityCollectionContainsRefString(Collection<Entity> entities, String entityRef) { for (Iterator<Entity> i = entities.iterator(); i.hasNext();) { Entity entity = i.next(); if (entity.getReference().equals(entityRef)) return true; } return false; }  static boolean isIntersectionEntityRefsToEntities(Collection<String> entityRefs, Collection<Entity> entities); static boolean isContainedEntityRefsToEntities(Collection<String> entityRefs, Collection<Entity> entities); static boolean isEqualEntityRefsToEntities(Collection<String> entityRefs, Collection<Entity> entities); static boolean entityCollectionContainsRefString(Collection<Entity> entities, String entityRef); static boolean refCollectionContainsEntity(Collection<String> refs, Entity entity); static void setEntityRefsFromEntities(Collection<String> refs, Collection<Entity> entities); static void computeAddedRemovedEntityRefsFromNewEntitiesOldRefs(Collection<String> addedEntities, Collection<String> removedEntities,
			Collection<Entity> newEntities, Collection<String> oldEntityRefs); }
EntityCollections { public static boolean entityCollectionContainsRefString(Collection<Entity> entities, String entityRef) { for (Iterator<Entity> i = entities.iterator(); i.hasNext();) { Entity entity = i.next(); if (entity.getReference().equals(entityRef)) return true; } return false; }  static boolean isIntersectionEntityRefsToEntities(Collection<String> entityRefs, Collection<Entity> entities); static boolean isContainedEntityRefsToEntities(Collection<String> entityRefs, Collection<Entity> entities); static boolean isEqualEntityRefsToEntities(Collection<String> entityRefs, Collection<Entity> entities); static boolean entityCollectionContainsRefString(Collection<Entity> entities, String entityRef); static boolean refCollectionContainsEntity(Collection<String> refs, Entity entity); static void setEntityRefsFromEntities(Collection<String> refs, Collection<Entity> entities); static void computeAddedRemovedEntityRefsFromNewEntitiesOldRefs(Collection<String> addedEntities, Collection<String> removedEntities,
			Collection<Entity> newEntities, Collection<String> oldEntityRefs);  }