@Test public void testRefCollectionContainsEntity() { Entity e1 = mock(Entity.class); when(e1.getReference()).thenReturn("/ref/e1"); Entity e2 = mock(Entity.class); when(e2.getReference()).thenReturn("/ref/e2"); assertTrue(refCollectionContainsEntity( Arrays.asList(new String[] { "/ref/e1", "/ref/e2" }), e1)); assertFalse(refCollectionContainsEntity( Arrays.asList(new String[] { "/ref/a1", "/ref/a2" }), e1)); assertFalse(refCollectionContainsEntity(Arrays.asList(new String[] {}), e1)); }
public static boolean refCollectionContainsEntity(Collection<String> refs, Entity entity) { String targetRef = entity.getReference(); for (Iterator<String> i = refs.iterator(); i.hasNext();) { String entityRef = i.next(); if (entityRef.equals(targetRef)) return true; } return false; }
EntityCollections { public static boolean refCollectionContainsEntity(Collection<String> refs, Entity entity) { String targetRef = entity.getReference(); for (Iterator<String> i = refs.iterator(); i.hasNext();) { String entityRef = i.next(); if (entityRef.equals(targetRef)) return true; } return false; } }
EntityCollections { public static boolean refCollectionContainsEntity(Collection<String> refs, Entity entity) { String targetRef = entity.getReference(); for (Iterator<String> i = refs.iterator(); i.hasNext();) { String entityRef = i.next(); if (entityRef.equals(targetRef)) return true; } return false; }  }
EntityCollections { public static boolean refCollectionContainsEntity(Collection<String> refs, Entity entity) { String targetRef = entity.getReference(); for (Iterator<String> i = refs.iterator(); i.hasNext();) { String entityRef = i.next(); if (entityRef.equals(targetRef)) 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 refCollectionContainsEntity(Collection<String> refs, Entity entity) { String targetRef = entity.getReference(); for (Iterator<String> i = refs.iterator(); i.hasNext();) { String entityRef = i.next(); if (entityRef.equals(targetRef)) 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);  }