Example usage for com.google.common.collect Lists newLinkedList

List of usage examples for com.google.common.collect Lists newLinkedList

Introduction

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

Prototype

@GwtCompatible(serializable = true)
public static <E> LinkedList<E> newLinkedList() 

Source Link

Document

Creates a mutable, empty LinkedList instance (for Java 6 and earlier).

Usage

From source file:org.plista.kornakapi.core.training.FromDirectoryVectorizer.java

private void generateSequneceFiles() {
    List<String> argList = Lists.newLinkedList();
    argList.add("-i");
    argList.add(DocumentFilesPath.toString());
    argList.add("-o");
    argList.add(sequenceFilesPath.toString());
    argList.add("-ow");
    String[] args = argList.toArray(new String[argList.size()]);
    try {/*from  w w w .  ja  v a  2  s .c o m*/
        ToolRunner.run(new SequenceFilesFromDirectory(), args);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.plista.kornakapi.core.training.LDATrainer.java

/**
 * Dumps the Topic distributen to file//from www. j av  a 2  s . c o  m
 * @param conf
 * @param input
 * @param output
 */
public static void printLocalTopicWordDistribution(RecommenderConfig conf, String input, String output) {
    List<String> argList = Lists.newLinkedList();
    argList.add("-i");
    argList.add(input);
    argList.add("-o");
    argList.add("/opt/kornakapi-model/lda/print/topics.txt");
    argList.add("--dictionaryType");
    argList.add("sequencefile");
    argList.add("-d");
    argList.add(((LDARecommenderConfig) conf).getTopicsDictionaryPath());
    argList.add("-sort");
    argList.add("true");
    argList.add("-vs");
    argList.add("100");
    String[] args = argList.toArray(new String[argList.size()]);
    try {
        //LDAPrintTopics.main(args);
        VectorDumper.main(args);
    } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.google.javascript.jscomp.OperaCompoundAssignFix.java

OperaCompoundAssignFix(AbstractCompiler compiler) {
    this.compiler = compiler;
    names = Lists.newLinkedList();
}

From source file:org.marketcetera.photon.internal.strategy.engine.ui.DeployedStrategyConfigurationComposite.java

/**
 * Constructor. Creates the UI widgets and binds them to the provided model.
 * //from w  ww  .  j  a  v  a  2 s .  co m
 * @param parent
 *            parent composite in which to create the widgets
 * @param dataBindingContext
 *            the data binding context to use for model-UI bindings
 * @param strategy
 *            the strategy model object
 */
public DeployedStrategyConfigurationComposite(Composite parent, DataBindingContext dataBindingContext,
        final DeployedStrategy strategy) {
    super(parent);
    mStrategy = strategy;

    GridLayoutFactory.swtDefaults().spacing(10, 5).numColumns(2).applyTo(this);
    List<Control> tabControls = Lists.newLinkedList();

    Messages.DEPLOYED_STRATEGY_CONFIGURATION_COMPOSITE_INSTANCE_NAME.createLabel(this);

    {
        Text instanceNameText = new Text(this, SWT.READ_ONLY);
        DataBindingUtils.bindValue(dataBindingContext, SWTObservables.observeText(instanceNameText, SWT.Modify),
                observe(StrategyEngineCorePackage.Literals.STRATEGY__INSTANCE_NAME));
    }

    Messages.DEPLOYED_STRATEGY_CONFIGURATION_COMPOSITE_CLASS.createLabel(this);

    {
        Text classText = new Text(this, SWT.READ_ONLY);
        DataBindingUtils.bindValue(dataBindingContext, SWTObservables.observeText(classText, SWT.Modify),
                observe(StrategyEngineCorePackage.Literals.STRATEGY__CLASS_NAME));
    }

    Messages.DEPLOYED_STRATEGY_CONFIGURATION_COMPOSITE_LANGUAGE.createLabel(this);

    {
        Text languageText = new Text(this, SWT.READ_ONLY);
        DataBindingUtils.bindValue(dataBindingContext, SWTObservables.observeText(languageText, SWT.Modify),
                observe(StrategyEngineCorePackage.Literals.STRATEGY__LANGUAGE));
    }

    Messages.DEPLOYED_STRATEGY_CONFIGURATION_COMPOSITE_SCRIPT.createLabel(this);

    {
        Text scriptText = new Text(this, SWT.READ_ONLY);
        DataBindingUtils.bindValue(dataBindingContext, SWTObservables.observeText(scriptText, SWT.Modify),
                observe(StrategyEngineCorePackage.Literals.STRATEGY__SCRIPT_PATH));
    }

    {
        Button routeButton = new Button(this, SWT.CHECK);
        routeButton.setText(Messages.STRATEGY_DEPLOYMENT_COMPOSITE_ROUTE.getRawLabel());
        routeButton.setToolTipText(Messages.STRATEGY_DEPLOYMENT_COMPOSITE_ROUTE.getTooltip());
        dataBindingContext.bindValue(SWTObservables.observeSelection(routeButton),
                observe(StrategyEngineCorePackage.Literals.STRATEGY__ROUTE_ORDERS_TO_SERVER));
        GridDataFactory.swtDefaults().span(2, 1).applyTo(routeButton);
        if (strategy.getState() == StrategyState.RUNNING) {
            routeButton.setEnabled(false);
            tabControls.add(routeButton);
        }
    }

    setTabList(tabControls.toArray(new Control[tabControls.size()]));
}

From source file:org.apache.kylin.measure.topn.TopNCounter.java

/**
 * @param capacity maximum size (larger capacities improve accuracy)
 *///from   w w w. j a  v a 2 s .co m
public TopNCounter(int capacity) {
    this.capacity = capacity;
    counterMap = Maps.newHashMap();
    counterList = Lists.newLinkedList();
}

From source file:org.sonar.plugins.core.timemachine.TendencyDecorator.java

public TendencyDecorator(TimeMachine timeMachine, MetricFinder metricFinder,
        TimeMachineConfiguration configuration) {
    this.timeMachine = timeMachine;
    this.analyser = new TendencyAnalyser();
    this.configuration = configuration;
    this.metrics = Lists.newLinkedList();
    for (Metric metric : metricFinder.findAll()) {
        if (metric.isNumericType()) {
            metrics.add(metric);//from w ww .  ja  v  a  2s . c  o m
        }
    }
}

From source file:org.apache.shindig.common.servlet.GuiceServletContextListener.java

public void contextInitialized(ServletContextEvent event) {
    ServletContext context = event.getServletContext();
    //HNN setting all system.properties specified in the web.xml
    setSystemProperties(context);//from  ww  w  . j  a  va 2  s  .  c  o m
    String moduleNames = context.getInitParameter(MODULES_ATTRIBUTE);
    List<Module> modules = Lists.newLinkedList();
    if (moduleNames != null) {
        for (String moduleName : StringUtils.split(moduleNames, ':')) {
            try {
                moduleName = moduleName.trim();
                if (moduleName.length() > 0) {
                    modules.add((Module) Class.forName(moduleName).newInstance());
                }
            } catch (InstantiationException e) {
                throw new RuntimeException(e);
            } catch (ClassNotFoundException e) {
                throw new RuntimeException(e);
            } catch (IllegalAccessException e) {
                throw new RuntimeException(e);
            }
        }
    }
    Injector injector = Guice.createInjector(Stage.PRODUCTION, modules);
    context.setAttribute(INJECTOR_ATTRIBUTE, injector);

    try {
        if (!jmxInitialized) {
            Manager.manage("ShindigGuiceContext", injector);
            jmxInitialized = true;
        }
    } catch (Exception e) {
        // Ignore errors
    }
}

From source file:org.apache.streams.converter.TypeConverterProcessor.java

@Override
public List<StreamsDatum> process(StreamsDatum entry) {

    List<StreamsDatum> result = Lists.newLinkedList();
    Object inDoc = entry.getDocument();

    Object outDoc = TypeConverterUtil.convert(inDoc, outClass, mapper);

    if (outDoc != null) {
        entry.setDocument(outDoc);/* ww w .j  a v  a2 s . c om*/
        result.add(entry);
    }

    return result;
}

From source file:com.android.tools.idea.npw.deprecated.ImportSourceModulePath.java

public ImportSourceModulePath(@NotNull NewModuleWizardState wizardState, @NotNull WizardContext context,
        @Nullable Icon sidePanelIcon, @Nullable TemplateWizardStep.UpdateListener listener) {
    myWizardState = wizardState;/*from   w w  w.  ja va 2s  . com*/
    myContext = context;
    List<ModuleWizardStep> steps = Lists.newLinkedList();
    ImportSourceLocationStep locationStep = new ImportSourceLocationStep(context, wizardState, sidePanelIcon,
            listener);
    steps.add(locationStep);
    for (ModuleImporter importer : ModuleImporter.getAllImporters(myContext)) {
        steps.addAll(importer.createWizardSteps());
    }
    mySteps = steps;
}

From source file:org.geogit.web.api.commands.GetCommitGraph.java

/**
 * Runs the command and builds the appropriate response.
 * //from  ww w  .jav  a  2 s.  co  m
 * @param context - the context to use for this command
 * 
 * @throws CommandSpecException
 */
@Override
public void run(CommandContext context) {
    if (commitId.equals(ObjectId.NULL.toString())) {
        throw new CommandSpecException("No commitId was given.");
    }
    final GeoGIT geogit = context.getGeoGIT();
    RevCommit commit = geogit.getRepository().getCommit(ObjectId.valueOf(commitId));
    final List<RevCommit> history = Lists.newLinkedList();

    List<CommitNode> nodes = Lists.newLinkedList();
    CommitNode node = new CommitNode(commit, 1);
    nodes.add(node);

    while (!nodes.isEmpty()) {
        node = nodes.remove(0);
        if (!history.contains(node.commit)) {
            history.add(node.commit);
        }
        if (this.depth == 0 || node.depth < this.depth) {
            for (ObjectId id : node.commit.getParentIds()) {
                nodes.add(new CommitNode(geogit.getRepository().getCommit(id), node.depth + 1));
            }
        }
    }

    context.setResponseContent(new CommandResponse() {

        @Override
        public void write(ResponseWriter out) throws Exception {
            out.start();
            out.writeCommits(history.iterator(), page, elementsPerPage);
            out.finish();
        }
    });
}