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:com.cloudera.director.google.compute.util.ComputeUrls.java

public static String buildZonalUrl(String projectId, String zone, String... resourcePathParts) {
    List<String> pathParts = Lists.newArrayList("zones", zone);

    if (resourcePathParts != null) {
        pathParts.addAll(Lists.newArrayList(resourcePathParts));
    }// w ww.j  av a  2s.  c o  m

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

From source file:com.android.tools.idea.ui.properties.expressions.bool.AnyExpression.java

public AnyExpression(Collection<? extends ObservableValue<Boolean>> values) {
    //noinspection unchecked
    this(Iterables.toArray(values, ObservableValue.class));
}

From source file:org.eclipse.buildship.core.workspace.internal.DefaultGradleClasspathContainer.java

public DefaultGradleClasspathContainer(IPath containerPath, List<IClasspathEntry> classpathEntries) {
    this.containerPath = Preconditions.checkNotNull(containerPath);
    this.classpathEntries = Iterables.toArray(classpathEntries, IClasspathEntry.class);
}

From source file:ec.nbdemetra.ui.demo.impl.TsListHandler.java

static JButton createInfoButton(final ITsList view) {
    JPopupMenu menu = new JPopupMenu();
    List<ITsList.InfoType> currentInfo = Lists.newArrayList(view.getInformation());
    for (final ITsList.InfoType o : ITsList.InfoType.values()) {
        JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(o.name());
        menuItem.setName(o.name());//from ww w .j a  v  a 2s .c  o  m
        menuItem.addActionListener(new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                List<ITsList.InfoType> tmp = Lists.newArrayList(view.getInformation());
                if (tmp.contains(o)) {
                    tmp.remove(o);
                } else {
                    tmp.add(o);
                }
                view.setInformation(Iterables.toArray(tmp, ITsList.InfoType.class));
            }
        });
        menuItem.setState(currentInfo.contains(o));
        menu.add(menuItem);
    }
    JButton result = DropDownButtonFactory.createDropDownButton(DemetraUiIcon.COMPILE_16, menu);
    result.addActionListener(new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent e) {
            view.setInformation(null);
        }
    });
    return result;
}

From source file:com.google.template.soy.jbcsrc.restricted.ConstructorRef.java

/**
 * Returns a new {@link ConstructorRef} that refers to a constructor on the given type with the
 * given parameter types.// w w w  . jav a2s. c  om
 */
public static ConstructorRef create(TypeInfo type, Iterable<Type> argTypes) {
    return create(type, new Method("<init>", Type.VOID_TYPE, Iterables.toArray(argTypes, Type.class)));
}

From source file:org.atteo.moonshine.jersey.JAXBContextResolver.java

public JAXBContextResolver() {

    try {//w  ww .  ja v  a2  s.  c o  m
        context = new JSONJAXBContext(
                JSONConfiguration.natural().usePrefixesAtNaturalAttributes().rootUnwrapping(true).build(),
                Iterables.toArray(ClassIndex.getAnnotated(ResourceModel.class), Class.class));
    } catch (JAXBException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.spotify.scio.extra.transforms.JavaAsyncDoFn.java

@SuppressWarnings("unchecked")
@Override/*from w  w  w. ja  v  a 2  s  .c om*/
protected void waitForFutures(Iterable<CompletableFuture<OutputT>> futures)
        throws InterruptedException, ExecutionException {
    CompletableFuture.allOf(Iterables.toArray(futures, CompletableFuture.class)).get();
}

From source file:org.testfx.service.query.impl.NodeQueryUtils.java

public static Set<Node> rootsOfWindows(Collection<Window> windows) {
    return rootOfWindow(Iterables.toArray(windows, Window.class));
}

From source file:com.subgraph.vega.ui.tree.web.WebHostTreeStrategy.java

@Override
public Object[] getChildren(IWebHost item) {
    IWebPath rootPath = item.getRootPath();
    boolean noResponses = (rootPath.getGetResponses().size() == 0) && (rootPath.getPostResponses().size() == 0);

    Collection<IWebPath> childPaths = rootPath.getChildPaths();

    if (childPaths.isEmpty() && noResponses)
        return new Object[] { rootPath };
    else if (childPaths.isEmpty())
        return Iterables.toArray(childPaths, Object.class);
    else// w  ww .ja  va 2  s.  com
        return pathTreeStrategy.getChildren(rootPath);
}

From source file:eu.esdihumboldt.hale.ui.views.data.internal.SimpleInstanceSelectionProvider.java

/**
 * Update the instance selection.//from  www  .  ja  v a 2 s . c  o  m
 * 
 * @param instances the selected instances
 */
public void updateSelection(Iterable<Instance> instances) {
    InstanceSelection selection;
    if (instances != null) {
        selection = new DefaultInstanceSelection(Iterables.toArray(instances, Instance.class));
    } else {
        selection = new DefaultInstanceSelection();
    }
    fireSelectionChange(selection);
}