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:org.opentestsystem.shared.monitoringalerting.service.impl.DiscreteIntakeServiceImpl.java

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

From source file:com.android.builder.internal.compiler.DexWrapper.java

@NonNull
private static Main.Arguments buildArguments(@NonNull DexProcessBuilder processBuilder,
        @NonNull DexOptions dexOptions, @NonNull DxContext dxContext) throws ProcessException {
    Main.Arguments args = new Main.Arguments();

    // Inputs:/*from w  w  w.j a v  a 2s  .  c  o  m*/
    args.fileNames = Iterables.toArray(processBuilder.getFilesToAdd(null), String.class);

    // Outputs:
    if (processBuilder.getOutputFile().isDirectory() && !processBuilder.isMultiDex()) {
        args.outName = new File(processBuilder.getOutputFile(), "classes.dex").getPath();
        args.jarOutput = false;
    } else {
        String outputFileAbsolutePath = processBuilder.getOutputFile().getAbsolutePath();
        args.outName = outputFileAbsolutePath;
        args.jarOutput = outputFileAbsolutePath.endsWith(SdkConstants.DOT_JAR);
    }

    // Multi-dex:
    args.multiDex = processBuilder.isMultiDex();
    if (processBuilder.getMainDexList() != null) {
        args.mainDexListFile = processBuilder.getMainDexList().getPath();
    }

    // Other:
    args.verbose = processBuilder.isVerbose();
    args.optimize = !processBuilder.isNoOptimize();
    args.numThreads = Objects.firstNonNull(dexOptions.getThreadCount(), 4);
    args.forceJumbo = dexOptions.getJumboMode();

    args.parseFlags(Iterables.toArray(dexOptions.getAdditionalParameters(), String.class));
    args.makeOptionsObjects(dxContext);

    return args;
}

From source file:org.apache.phoenix.pig.util.TableSchemaParserFunction.java

@Override
public Pair<String, String> apply(final String tableSchema) {
    Preconditions.checkNotNull(tableSchema);
    Preconditions.checkArgument(!tableSchema.isEmpty(), "HBase Table name is empty!!");

    final String tokens[] = Iterables.toArray(
            Splitter.on(TABLE_COLUMN_DELIMITER).trimResults().omitEmptyStrings().split(tableSchema),
            String.class);
    final String tableName = tokens[0];
    String columns = null;//  w w w .j  av a  2s. c o m
    if (tokens.length > 1) {
        columns = tokens[1];
    }
    return new Pair<String, String>(tableName, columns);
}

From source file:org.elasticsearch.index.translog.memory.MemorySnapshot.java

public MemorySnapshot(Translog.Snapshot snapshot) {
    this(snapshot.translogId(), Iterables.toArray(snapshot, Translog.Operation.class));
}

From source file:com.textocat.textokit.dictmatcher.mensa.MensaChunkerBuilder.java

@Override
public void addEntry(Iterable<String> aTokens, V metadata) {
    String[] tokens = Iterables.toArray(aTokens, String.class);
    dictEntries.add(new Keyword<>(tokens, metadata));
    entryCounter += 1;//from  ww w . ja  v a 2s.  c  om
    if (entryCounter % loggingFrequency == 0) {
        log.info("{} entries have been added", entryCounter);
    }
}

From source file:net.citizensnpcs.resources.sk89q.CommandContext.java

public CommandContext(String[] args) {
    int i = 1;//from  w w  w.j a v  a  2  s .  c  om
    for (; i < args.length; i++) {
        if (args[i].length() == 0) {
            // Ignore this
        } else if (args[i].charAt(0) == '-' && args[i].matches("^-[a-zA-Z]+$")) {
            for (int k = 1; k < args[i].length(); k++) {
                flags.add(args[i].charAt(k));
            }
            args[i] = "";
        }
    }
    this.args = Iterables.toArray(
            Splitter.on(" ").omitEmptyStrings().split(Joiner.on(" ").skipNulls().join(args)), String.class);
}

From source file:com.samskivert.depot.Ops.java

/**
 * Creates an OR expression with the supplied target expressions.
 *//*from w ww . j a va  2  s.co  m*/
public static FluentExp<Boolean> or(Iterable<? extends SQLExpression<?>> conditions) {
    return or(Iterables.toArray(conditions, SQLExpression.class));
}

From source file:com.cloudera.director.google.compute.util.ComputeUrls.java

public static String buildRegionalUrl(String projectId, String region, String... resourcePathParts) {
    List<String> pathParts = Lists.newArrayList("regions", region);

    if (resourcePathParts != null) {
        pathParts.addAll(Lists.newArrayList(resourcePathParts));
    }/*from  w  w  w  .ja va 2s .co  m*/

    return buildGoogleComputeApisUrl(projectId, Iterables.toArray(pathParts, String.class));
}

From source file:org.fundacionjala.enforce.sonarqube.apex.rules.ApexRulesDefinition.java

/**
 * Loads apex custom rules in the repository.
 *
 * @param context builder.//from  ww w.j  ava  2 s .c om
 */
@Override
public void define(Context context) {
    NewRepository repository = context.createRepository(CheckList.REPOSITORY_KEY, Apex.KEY)
            .setName(CheckList.REPOSITORY_NAME);
    List<Class> checks = CheckList.getChecks();
    new RulesDefinitionAnnotationLoader().load(repository, Iterables.toArray(checks, Class.class));
    checks.stream().forEach((ruleClass) -> {
        newRule(ruleClass, repository);
    });
    repository.done();
}

From source file:org.erlide.ui.util.ETreeNodeContentProvider.java

@Override
public Object[] getChildren(final Object parentElement) {
    final ETreeNode node = (ETreeNode) parentElement;
    if (node.getChildren() == null) {
        return new Object[0];
    }/* w  ww . ja va2  s. c  o  m*/
    return Iterables.toArray(node.getChildren(), Object.class);
}