List of usage examples for com.google.common.collect Iterables filter
@GwtIncompatible("Class.isInstance") @CheckReturnValue public static <T> Iterable<T> filter(final Iterable<?> unfiltered, final Class<T> desiredType)
From source file:org.broad.igv.dev.plugin.ui.TrackArgument.java
public TrackArgument(Argument argument) { initComponents();//from w ww . j ava 2 s . co m super.initCommon(argument); if (argument != null) { List<Track> trackList = IGV.getInstance().getAllTracks(); Class clazz = getTrackClass(argument); Iterable<Track> tracks = Iterables.filter(trackList, clazz); trackComboBox.setModel(new DefaultComboBoxModel(Lists.newArrayList(tracks).toArray())); trackComboBox.setRenderer(new TrackComboBoxRenderer()); } }
From source file:org.apache.brooklyn.entity.software.base.VanillaWindowsProcessImpl.java
@Override protected void preStart() { super.preStart(); sensors().set(RDP_PORT, 3389);/* www .j a va 2 s.co m*/ sensors().set(RDP_PORT_CAMEL_CASE, 3389); WinRmMachineLocation loc = Iterables.getFirst(Iterables.filter(getLocations(), WinRmMachineLocation.class), null); if (loc != null) { sensors().set(WINRM_PORT, loc.getPort()); sensors().set(WINRM_PORT_SHORTEN, loc.getPort()); sensors().set(WINRM_PORT_CAMEL_CASE, loc.getPort()); } }
From source file:org.sonarsource.sonarlint.core.container.analysis.filesystem.AbstractFilePredicate.java
@Override public Iterable<InputFile> filter(Iterable<InputFile> target) { return Iterables.filter(target, AbstractFilePredicate.this::apply); }
From source file:org.caleydo.view.tourguide.api.adapter.ATourGuideDataMode.java
/** * @return/*w ww .ja v a 2 s.c o m*/ */ public Collection<? extends IDataDomain> getAllDataDomains() { List<IDataDomain> dataDomains = Lists .newArrayList(Iterables.filter(DataDomainManager.get().getDataDomains(), this)); Collections.sort(dataDomains, Labels.BY_LABEL); return dataDomains; }
From source file:org.trancecode.collection.TcSets.java
public static <T> ImmutableSet<T> immutableSetWithout(final Iterable<T> elements, final T element) { Preconditions.checkNotNull(elements); Preconditions.checkNotNull(element); if (elements instanceof Set && !((Set<?>) elements).contains(element)) { return ImmutableSet.copyOf(elements); }/*from w w w. j a v a 2s . c om*/ return ImmutableSet.copyOf(Iterables.filter(elements, Predicates.not(Predicates.equalTo(element)))); }
From source file:fr.obeo.dsl.designer.documentation.generator.internal.extensions.GeneratorRegistry.java
public Iterable<IDocumentationGeneratorDescriptor> getGenerators(final EObject context) { return Iterables.filter(generators.values(), new Predicate<IDocumentationGeneratorDescriptor>() { @Override/*from w ww.j av a 2 s .co m*/ public boolean apply(IDocumentationGeneratorDescriptor arg0) { return arg0.appliesOn(context); } }); }
From source file:org.apache.isis.core.metamodel.facets.object.membergroups.annotprop.MemberGroupLayoutFacetProperties.java
static String[] asGroupList(Properties properties, final String key) { final String property = properties.getProperty(key); if (property == null) { return new String[0]; }/*w w w. j av a 2 s. c o m*/ final Iterable<String> split = Splitter.on(',').split(property); return Iterables.toArray( Iterables.filter(Iterables.transform(split, StringFunctions.TRIM), StringPredicates.NOT_EMPTY), String.class); }
From source file:com.twitter.aurora.scheduler.quota.Quotas.java
/** * Determines the amount of quota required for production tasks among {@code tasks}. * * @param tasks Tasks to count quota from. * @return Quota requirement to run {@code tasks}. *///w w w .j a v a2 s .c o m public static IQuota fromProductionTasks(Iterable<ITaskConfig> tasks) { checkNotNull(tasks); return fromTasks(Iterables.filter(tasks, Tasks.IS_PRODUCTION)); }
From source file:org.trancecode.xml.saxon.SaxonAxis.java
public static Iterable<XdmNode> childElements(final XdmNode node, final Collection<QName> elementNames) { return Iterables.filter(childElements(node), Predicates.compose(TcPredicates.matches(elementNames), SaxonFunctions.getNodeName())); }
From source file:edu.umn.msi.tropix.proteomics.FileDTAListImpl.java
public void populate(final String baseName) { final Iterable<String> dtaResources = Iterables.filter(parentDirectory.getResourceNames(null), StringPredicates.matches(".*\\.[dD][tT][aA]")); for (final String dtaResource : dtaResources) { addContents(dtaResource);//from w w w . java2 s. c o m final String fileName = dtaResource; if (baseName == null) { addName(fileName); } else { addName(baseName + fileName.substring(fileName.indexOf('.'))); } } }