List of usage examples for com.google.common.collect Iterables isEmpty
public static boolean isEmpty(Iterable<?> iterable)
From source file:com.cloudera.nav.sdk.client.MetadataResultIterator.java
public MetadataResultIterator(NavApiCient client, MetadataType type, String query, Integer limit, Iterable<String> extractorRunIds) { this.client = client; this.type = type; this.userQuery = query; this.limit = limit; this.partitionRunIdIterator = Iterables.partition(extractorRunIds, MAX_QUERY_PARTITION_SIZE).iterator(); if (Iterables.isEmpty(extractorRunIds)) { nextQuery = userQuery;// w w w . ja v a 2 s.c o m } else { getNextQuery(); } getNextBatch(); }
From source file:com.b2international.snowowl.snomed.api.impl.FsnJoinerOperation.java
public final List<T> run() { final Iterable<SnomedConcept> concepts = getConceptEntries(conceptId); if (Iterables.isEmpty(concepts)) { return ImmutableList.of(); }/*w w w. j av a 2 s . co m*/ Map<String, SnomedDescription> descriptionsByConcept = initDescriptionsByConcept(concepts); return convertConceptEntries(concepts, descriptionsByConcept); }
From source file:org.jboss.hal.core.mbui.dialog.AddResourceDialog.java
public AddResourceDialog(String id, String title, Metadata metadata, Iterable<String> attributes, Callback callback) {/*from w ww. j av a 2s .c o m*/ nameItem = new NameItem(); ModelNodeForm.Builder<ModelNode> formBuilder = new ModelNodeForm.Builder<>(id, metadata) .unboundFormItem(nameItem, 0).fromRequestProperties().requiredOnly() .onSave((f, changedValues) -> saveForm(callback, form.getModel())); if (!Iterables.isEmpty(attributes)) { formBuilder.include(attributes).unsorted(); } init(title, formBuilder.build()); }
From source file:com.isotrol.impe3.pms.core.obj.DevicePagesObject.java
/** * Builds a collection from a set of pages. * @param portal Portal Id./* w w w . ja va2 s . co m*/ * @param device Device Id. * @param pages Pages. * @param parent Parent pages. * @return The requested collection. */ static DevicePagesObject of(UUID portal, UUID device, Iterable<PageObject> pages, DevicePagesObject parent) { if (Iterables.isEmpty(pages) && (parent == null || parent.isEmpty())) { return of(portal, device); } return new Pages(portal, device, pages, parent); }
From source file:org.eclipse.sirius.diagram.ui.tools.internal.actions.repair.AbstractAbstractDNodeDiagramElementState.java
/** * {@inheritDoc}//from ww w .j av a 2 s .co m * * @see org.eclipse.sirius.diagram.tools.internal.actions.repair.AbstractDiagramElementState#storeElementState(EObject, * DiagramElementMapping, org.eclipse.sirius.diagram.DDiagramElement) */ @Override public void storeElementState(EObject target, DiagramElementMapping mapping, D element) { super.storeElementState(target, mapping, element); Iterable<ArrangeConstraint> existingArrangeConstraints = Iterables.filter(element.getArrangeConstraints(), ArrangeConstraint.class); if (!Iterables.isEmpty(existingArrangeConstraints)) { Iterables.addAll(arrangeConstraints, existingArrangeConstraints); } }
From source file:org.sonar.plugins.pmd.PmdSensor.java
private boolean hasFilesToCheck(Type type, String repositoryKey) { FilePredicates predicates = fs.predicates(); Iterable<File> files = fs.files(predicates.and(predicates.hasLanguage(Java.KEY), predicates.hasType(type))); return !Iterables.isEmpty(files) && !profile.getActiveRulesByRepository(repositoryKey).isEmpty(); }
From source file:org.apache.aurora.common.base.MorePreconditions.java
/** * Checks that an Iterable is both non-null and non-empty. This method does not check individual * elements in the Iterable, it just checks that the Iterable has at least one element. * * @param argument the argument to validate * @param message the message template for validation exception messages where %s serves as the * sole argument placeholder//from w ww .j a v a 2s . c o m * @param args any arguments needed by the message template * @return the argument if it is valid * @throws NullPointerException if the argument is null * @throws IllegalArgumentException if the argument has no iterable elements */ public static <S, T extends Iterable<S>> T checkNotBlank(T argument, String message, Object... args) { Preconditions.checkNotNull(argument, message, args); Preconditions.checkArgument(!Iterables.isEmpty(argument), message, args); return argument; }
From source file:com.google.api.server.spi.config.model.ApiNamespaceConfig.java
@Override public boolean equals(Object o) { if (this == o) { return true; }/* ww w . j a v a2 s . com*/ if (!(o instanceof ApiNamespaceConfig)) { return false; } ApiNamespaceConfig that = (ApiNamespaceConfig) o; return Iterables.isEmpty(getConfigurationInconsistencies(that)); }
From source file:org.icgc.dcc.portal.util.ElasticsearchResponseUtils.java
/** * Returns first value of the list as a String *//*from w w w .j av a2 s . co m*/ public static String getString(Object values) { if (values == null) { return null; } if (values instanceof Iterable<?>) { val iterable = (Iterable<?>) values; return Iterables.isEmpty(iterable) ? null : Iterables.get(iterable, 0).toString(); } if (values instanceof String) { return values.toString(); } return null; }
From source file:org.tensorics.core.iterable.lang.QuantityIterableSupport.java
public final QuantifiedValue<V> stdOf(Iterable<QuantifiedValue<V>> values) { if (Iterables.isEmpty(values)) { throw new IllegalArgumentException("Standard deviation of empty value set is not possible."); }/*from w w w. j a v a 2 s . c o m*/ return squareRootOf(varOf(values)); }