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

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

Introduction

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

Prototype

static <T> T[] toArray(Iterable<? extends T> iterable, T[] array) 

Source Link

Usage

From source file:ec.tss.sa.RegArimaReport.java

public SarimaSpecification[] getModels() {
    SarimaSpecification[] m = Iterables.toArray(arima_.keySet(), SarimaSpecification.class);
    //Arrays.sort(m, null);
    return m;/* w  ww  . j a v  a  2s  .c  o  m*/
}

From source file:edu.umn.msi.tropix.persistence.service.impl.SampleServiceImpl.java

public ProteomicsRun[] getProteomicsRuns(final String userId, final String tissueSampleId) {
    final TissueSample sample = getTropixObjectDao().loadTropixObject(tissueSampleId, TissueSample.class);
    Iterable<ProteomicsRun> runs = sample.getProteomicsRuns();
    if (runs == null) {
        runs = Lists.newArrayList();//from   w  w w.j  av a  2s .c  o m
    }
    return Iterables.toArray(
            Iterables.filter(runs, Predicates.getValidAndCanReadPredicate(getSecurityProvider(), userId)),
            ProteomicsRun.class);
}

From source file:eu.esdihumboldt.hale.ui.cst.debug.metadata.internal.GraphMLContentProvider.java

/**
 * @see org.eclipse.jface.viewers.ArrayContentProvider#getElements(java.lang.Object)
 *//* w ww  . j  av a  2 s .co  m*/
@SuppressWarnings("unchecked")
@Override
public Object[] getElements(Object inputElement) {
    if (inputElement instanceof Iterable<?>) {
        return super.getElements(Iterables.toArray((Iterable<Edge>) inputElement, Edge.class));
    } else
        return new Object[0];
}

From source file:com.brighttag.kairosdb.TridentDataPoint.java

protected @Nullable String[] parseJsonArray() {
    Type listType = new TypeToken<List<String>>() {
    }.getType();/*www.j a v a 2 s  .c  om*/
    try {
        List<String> parts = gson.fromJson(value, listType);
        return Iterables.toArray(parts, String.class);
    } catch (JsonSyntaxException e) {
        return null;
    }
}

From source file:org.eclipse.wb.internal.core.model.util.ObjectsTreeContentProvider.java

public Object[] getChildren(Object parentElement) {
    List<ObjectInfo> children = ((ObjectInfo) parentElement).getChildren();
    Iterable<ObjectInfo> filtered = Iterables.filter(children, m_predicate);
    return Iterables.toArray(filtered, ObjectInfo.class);
}

From source file:com.google.devtools.depan.view_doc.layout.eclipse.ui.widgets.WizardMenuContributions.java

@Override
protected IContributionItem[] getContributionItems() {
    IWorkbenchWindow frame = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    List<LayoutPlanDocument<? extends LayoutPlan>> topLayouts = LayoutResources.getTopLayouts();
    List<IContributionItem> result = Lists.newArrayListWithExpectedSize(topLayouts.size());
    for (LayoutPlanDocument<? extends LayoutPlan> layoutDoc : topLayouts) {
        buildWizardItem(frame, layoutDoc.getName(), layoutDoc);
    }// w w  w. j  ava 2s. c om
    return Iterables.toArray(result, IContributionItem.class);
}

From source file:org.eclipse.viatra.addon.viewers.runtime.sources.ListContentProvider.java

@Override
public Object[] getElements(Object inputElement) {
    if (state == null) {
        return new Object[0];
    }/*from   w ww  . j  av a2 s.  c o  m*/
    return Iterables.toArray(state.getItems(), Item.class);
}

From source file:eu.esdihumboldt.hale.ui.functions.groovy.internal.HelperFunctionContentProvider.java

/**
 * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
 *///  w w w.j a  va2 s .com
@Override
public Object[] getElements(Object inputElement) {

    if (inputElement instanceof Category) {
        Iterable<HelperFunctionOrCategory> x = helperFunctionService.getChildren((Category) inputElement);
        return Iterables.toArray(x, HelperFunctionOrCategory.class);

    }

    return null;
}

From source file:minium.web.internal.expression.FunctionInvocationExpression.java

@Override
public Object[] getArgs() {
    List<Object> allArgs = Lists.newArrayList();
    addArgs(allArgs, parentExpression.getArgs());
    for (Expression argExpression : argExpressions) {
        addArgs(allArgs, argExpression.getArgs());
    }//  w  w w . j av  a2  s . co m
    return Iterables.toArray(allArgs, Object.class);
}

From source file:org.opentestsystem.shared.monitoringalerting.service.impl.DiscreteIntakeServiceImpl.java

@Override
public String[] getDistinctServers() {
    return Iterables.toArray(
            Lists.transform(this.discreteIntakeRepository.findByType(TYPE.SERVER), VALUE_TRANSFORMER),
            String.class);
}