Example usage for com.google.common.collect Iterables find

List of usage examples for com.google.common.collect Iterables find

Introduction

In this page you can find the example usage for com.google.common.collect Iterables find.

Prototype

@Nullable
public static <T> T find(Iterable<? extends T> iterable, Predicate<? super T> predicate,
        @Nullable T defaultValue) 

Source Link

Document

Returns the first element in iterable that satisfies the given predicate, or defaultValue if none found.

Usage

From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.PracticeSiteSectionHelper.java

private PracticeSiteListing getListing(Predicate<PracticeSiteListing> predicate) {
    return Iterables.find(section.getListings(), predicate, null);
}

From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.LicenseSectionHelper.java

private LicenseListing getListingByValues(final MedicalLicense license) {
    return Iterables.find(section.getListings(), new Predicate<LicenseListing>() {
        @Override/*from  ww  w  .j a v a  2 s  .  com*/
        public boolean apply(LicenseListing listing) {
            return isEquivalent(license, listing);
        }
    }, null);
}

From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.SpecialtySectionHelper.java

private SpecialtyListing getListingByValues(final BoardCertifiedSpecialty specialty) {
    return Iterables.find(section.getListings(), new Predicate<SpecialtyListing>() {
        @Override/*ww w .  j a  v a 2  s  . c om*/
        public boolean apply(SpecialtyListing listing) {
            return isEquivalent(specialty, listing);
        }
    }, null);
}

From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.IrbSectionHelper.java

public IrbListing getAnyOtherListing(final Organization organization) {
    return Iterables.find(section.getListings(), new Predicate<IrbListing>() {
        @Override//from www  . ja  v a2 s .c  om
        public boolean apply(IrbListing listing) {
            return !isEquivalent(listing, organization);
        }
    }, null);
}

From source file:gov.nih.nci.firebird.selenium2.pages.investigator.annual.registration.FinancialDisclosureTabHelper.java

private PharmaceuticalCompanyListing getByExternalId(final Organization pharmaceuticalCompany) {
    return Iterables.find(tab.getListings(), new Predicate<PharmaceuticalCompanyListing>() {
        @Override//ww  w  .  j  a v a2  s  .  co m
        public boolean apply(PharmaceuticalCompanyListing listing) {
            return ObjectUtils.equals(listing.getId(), pharmaceuticalCompany.getExternalId());
        }
    }, null);
}

From source file:gov.nih.nci.firebird.selenium2.pages.components.CredentialsCvIdfDisplayComponentHelper.java

private <C extends AbstractCredential<?>, L extends CredentialListing<C>> L getListingByValue(
        final C credential, List<L> listings) {
    return Iterables.find(listings, new Predicate<L>() {
        @Override//w  w  w. ja v a  2 s.co m
        public boolean apply(L input) {
            return input.isEquivalent(credential);
        }
    }, null);
}

From source file:gov.nih.nci.firebird.selenium2.pages.investigator.profile.ClinicalLabSectionHelper.java

public ClinicalLabListing getAnyOtherListing(final Organization organization) {
    return Iterables.find(section.getListings(), new Predicate<ClinicalLabListing>() {
        @Override//  ww w  . ja v a 2  s.co  m
        public boolean apply(ClinicalLabListing listing) {
            return !isEquivalent(listing, organization);
        }
    }, null);
}

From source file:com.twitter.aurora.scheduler.configuration.ConfigurationManager.java

@Nullable
private static IConstraint getDedicatedConstraint(ITaskConfig task) {
    return Iterables.find(task.getConstraints(), getConstraintByName(DEDICATED_ATTRIBUTE), null);
}

From source file:gov.nih.nci.firebird.selenium2.pages.investigator.annual.registration.FinancialDisclosureTabHelper.java

private PharmaceuticalCompanyListing getListingByValues(final Organization pharmaceuticalCompany) {
    return Iterables.find(tab.getListings(), new Predicate<PharmaceuticalCompanyListing>() {
        @Override//  w  w w.  j  a v  a 2 s  .co  m
        public boolean apply(PharmaceuticalCompanyListing listing) {
            return isEquivalent(listing, pharmaceuticalCompany);
        }
    }, null);
}

From source file:ru.ksu.niimm.cll.mocassin.crawl.parser.latex.StructureBuilderImpl.java

private String extractTitle(OutlineNode node, LatexDocumentModel model) {
    int nodeType = node.getType();
    String nodeName = node.getName();
    String nodeTitle = null;//from  ww w.  j av a 2s  . c  om
    if (nodeType == OutlineNode.TYPE_SECTION || nodeType == OutlineNode.TYPE_SUBSECTION
            || nodeType == OutlineNode.TYPE_SUBSUBSECTION) {

        nodeTitle = nodeName;
    } else {
        NewtheoremCommand foundCommand = Iterables.find(model.getNewtheorems(),
                new NewtheoremCommand.KeyPredicate(nodeName), null);
        if (foundCommand != null) {
            nodeTitle = foundCommand.getTitle();
        } else {
            nodeTitle = nodeName;
        }
    }
    return nodeTitle;
}