@Override public void clear() { Iterables.removeIf(unfiltered, predicate); }
@Override public void clear() { Iterables.removeIf(unfiltered, predicate); }
public void removeRealization(final RealizationType type, final String realization) { Iterables.removeIf(this.realizationEntries, new Predicate<RealizationEntry>() { @Override public boolean apply(RealizationEntry input) { return input.getType() == type && input.getRealization().equalsIgnoreCase(realization); } }); }
@Override public void clear() { Iterables.removeIf(unfiltered, predicate); }
/** * Removes basic permission acls (unamed acls) from the list of acl entries * @param entries acl entries to remove from. */ private static void removeBaseAclEntries(List<AclEntry> entries) { Iterables.removeIf(entries, new Predicate<AclEntry>() { @Override public boolean apply(AclEntry input) { if (input.getName() == null) { return true; } return false; } }); }
/** * Removes basic permission acls (unamed acls) from the list of acl entries * @param entries acl entries to remove from. */ private static void removeBaseAclEntries(List<AclEntry> entries) { Iterables.removeIf(entries, new Predicate<AclEntry>() { @Override public boolean apply(AclEntry input) { if (input.getName() == null) { return true; } return false; } }); }
private void removeBlankLinesIn(Iterable<String> services) { Iterables.removeIf(services, Predicates.equalTo("")); }
@Override public boolean retainAll(Collection<?> c) { return Iterables.removeIf( multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and( multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c))))); }
@Override public boolean removeAll(Collection<?> c) { return Iterables.removeIf( multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and( multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.in(c)))); }
@Override public boolean retainAll(Collection<?> c) { return Iterables.removeIf( multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and( multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c))))); }
@Override public boolean removeAll(Collection<?> c) { return Iterables.removeIf( multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and( multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.in(c)))); }
@Override public boolean retainAll(Collection<?> c) { return Iterables.removeIf( multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and( multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.not(Predicates.in(c))))); }
@Override public boolean removeAll(Collection<?> c) { return Iterables.removeIf( multimap.unfiltered().entries(), // explicit <Entry<K, V>> is required to build with JDK6 Predicates.<Entry<K, V>>and( multimap.entryPredicate(), Maps.<V>valuePredicateOnEntries(Predicates.in(c)))); }
public void testFromArrayAndIteratorRemove() { FluentIterable<TimeUnit> units = FluentIterable.from(TimeUnit.values()); try { Iterables.removeIf(units, Predicates.equalTo(TimeUnit.SECONDS)); fail("Expected an UnsupportedOperationException to be thrown but it wasn't."); } catch (UnsupportedOperationException expected) { } }
/** * Chains a given {@link List} of {@link JobListener}s into a single {@link JobListener}. The specified {@link JobListener}s * will all be executed in parallel. * * @param jobListeners is a {@link List} of {@link JobListener}s that need to be executed * * @return a {@link CloseableJobListener}, which is similar to {@link JobListener}, except * {@link CloseableJobListener#close()} will block until all {@link JobListener}s have finished their executions. */ public static CloseableJobListener parallelJobListener(List<JobListener> jobListeners) { Iterables.removeIf(jobListeners, Predicates.isNull()); return new ParallelJobListener(jobListeners); }
public void testRemoveIf_noRandomAccess() { List<String> list = Lists.newLinkedList(asList("a", "b", "c", "d", "e")); assertTrue( Iterables.removeIf( list, new Predicate<String>() { @Override public boolean apply(String s) { return s.equals("b") || s.equals("d") || s.equals("f"); } })); assertEquals(newArrayList("a", "c", "e"), list); assertFalse( Iterables.removeIf( list, new Predicate<String>() { @Override public boolean apply(String s) { return s.equals("x") || s.equals("y") || s.equals("z"); } })); assertEquals(newArrayList("a", "c", "e"), list); }
public void testRemoveIf_randomAccess() { List<String> list = newArrayList("a", "b", "c", "d", "e"); assertTrue( Iterables.removeIf( list, new Predicate<String>() { @Override public boolean apply(String s) { return s.equals("b") || s.equals("d") || s.equals("f"); } })); assertEquals(newArrayList("a", "c", "e"), list); assertFalse( Iterables.removeIf( list, new Predicate<String>() { @Override public boolean apply(String s) { return s.equals("x") || s.equals("y") || s.equals("z"); } })); assertEquals(newArrayList("a", "c", "e"), list); }
public void testRemoveIf_iterable() { final List<String> list = Lists.newLinkedList(asList("a", "b", "c", "d", "e")); Iterable<String> iterable = new Iterable<String>() { @Override public Iterator<String> iterator() { return list.iterator(); } }; assertTrue( Iterables.removeIf( iterable, new Predicate<String>() { @Override public boolean apply(String s) { return s.equals("b") || s.equals("d") || s.equals("f"); } })); assertEquals(newArrayList("a", "c", "e"), list); assertFalse( Iterables.removeIf( iterable, new Predicate<String>() { @Override public boolean apply(String s) { return s.equals("x") || s.equals("y") || s.equals("z"); } })); assertEquals(newArrayList("a", "c", "e"), list); }
public void testRemoveIf_randomAccess_notPermittingDuplicates() { // https://github.com/google/guava/issues/1596 List<String> uniqueList = newArrayList("a", "b", "c", "d", "e"); assertThat(uniqueList).containsNoDuplicates(); assertTrue(uniqueList instanceof RandomAccess); assertTrue( Iterables.removeIf( uniqueList, new Predicate<String>() { @Override public boolean apply(String s) { return s.equals("b") || s.equals("d") || s.equals("f"); } })); assertEquals(newArrayList("a", "c", "e"), uniqueList); assertFalse( Iterables.removeIf( uniqueList, new Predicate<String>() { @Override public boolean apply(String s) { return s.equals("x") || s.equals("y") || s.equals("z"); } })); assertEquals(newArrayList("a", "c", "e"), uniqueList); }