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.opennms.netmgt.measurements.model.FilterDef.java

public FilterDef(String name, String... paramNamesAndValues) {
    // Combine the varargs into key-value pairs
    if (paramNamesAndValues.length % 2 != 0) {
        throw new IllegalArgumentException("Must have an even number of parameter names and values");
    }//from  w  w  w  .  j a v  a 2  s  .  c  o m
    List<FilterParamDef> parameters = Lists.newLinkedList();
    for (int i = 0; i < paramNamesAndValues.length; i += 2) {
        parameters.add(new FilterParamDef(paramNamesAndValues[i], paramNamesAndValues[i + 1]));
    }

    this.name = name;
    this.parameters = parameters;
}

From source file:rabbit.ui.internal.pages.CommonToolBarBuilder.java

public CommonToolBarBuilder() {
    groupByActions = Lists.newLinkedList();
    colorByActions = Lists.newLinkedList();
}

From source file:org.sonar.plugins.groovy.codenarc.CodeNarcXMLParser.java

@Override
public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException {
    rootCursor.advance();//from  w w w  . j  a v a2  s  .  c  om
    SMInputCursor items = rootCursor.descendantElementCursor();
    List<String> sourceDirectories = Lists.newLinkedList();
    while (items.getNext() != null) {
        String localName = items.getLocalName();
        if ("Project".equals(localName)) {
            SMInputCursor sourceDirectoryCursor = items.descendantElementCursor("SourceDirectory");
            while (sourceDirectoryCursor.getNext() != null) {
                String value = sourceDirectoryCursor.getElemStringValue();
                if (StringUtils.isNotBlank(value)) {
                    sourceDirectories.add(value.trim().replaceAll("\\\\", "/") + "/");
                }
            }
        } else if ("Package".equals(localName)) {
            String packPath = items.getAttrValue("path");
            SMInputCursor file = items.descendantElementCursor("File");
            while (file.getNext() != null) {
                String filename = getFilename(sourceDirectories, packPath, file.getAttrValue("name"));
                SMInputCursor violation = file.childElementCursor("Violation");
                while (violation.getNext() != null) {
                    String lineNumber = violation.getAttrValue("lineNumber");
                    String ruleName = violation.getAttrValue("ruleName");

                    SMInputCursor messageCursor = violation.childElementCursor("Message");
                    String message = messageCursor.getNext() == null ? ""
                            : messageCursor.collectDescendantText(true);

                    result.add(new CodeNarcViolation(ruleName, filename, lineNumber, message));
                }
            }
        }
    }
}

From source file:org.ldp4j.application.kernel.session.MemberCollection.java

private MemberCollection() {
    this.members = Maps.newLinkedHashMap();
    this.newMembers = Lists.newLinkedList();
}

From source file:org.terasology.monitoring.impl.PerformanceMonitorImpl.java

public PerformanceMonitorImpl() {
    timer = (EngineTime) CoreRegistry.get(Time.class);
    activityStack = Queues.newArrayDeque();
    metricData = Lists.newLinkedList();
    allocationData = Lists.newLinkedList();
    runningTotals = new TObjectLongHashMap<>();
    runningAllocationTotals = new TObjectLongHashMap<>();
    timerTicksPerSecond = 1000;//from   ww  w  .  j  ava 2  s .  c  om
    currentData = new TObjectLongHashMap<>();
    currentMemData = new TObjectLongHashMap<>();
    spikeData = new TObjectDoubleHashMap<>();
    timeFactor = 1000.0 / timerTicksPerSecond;
    mainThread = Thread.currentThread();

}

From source file:com.cloudbees.jenkins.plugins.amazonecr.AmazonECSRegistryCredentialsProvider.java

@NonNull
@Override//from www.  j  a v  a 2  s . co m
public <C extends Credentials> List<C> getCredentials(@NonNull Class<C> type, @Nullable ItemGroup itemGroup,
        @Nullable Authentication authentication) {

    if (!type.isAssignableFrom(AmazonECSRegistryCredential.class)) {
        return ImmutableList.of();
    }

    List<C> derived = Lists.newLinkedList();

    final List<AmazonWebServicesCredentials> list = lookupCredentials(AmazonWebServicesCredentials.class,
            itemGroup, ACL.SYSTEM, Collections.EMPTY_LIST);

    for (AmazonWebServicesCredentials credentials : list) {
        derived.add((C) new AmazonECSRegistryCredential(credentials.getScope(), credentials.getId()));
    }

    return derived;
}

From source file:org.sonar.plugins.gosu.codenarc.CodeNarcXMLParser.java

@Override
public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException {
    rootCursor.advance();//from w ww.  j  av  a  2  s.co m
    SMInputCursor items = rootCursor.descendantElementCursor();
    List<String> sourceDirectories = Lists.newLinkedList();
    while (items.getNext() != null) {
        String localName = items.getLocalName();
        if ("Project".equals(localName)) {
            extractSourceDirectories(items, sourceDirectories);
        } else if ("Package".equals(localName)) {
            extractIssues(items, sourceDirectories);
        }
    }
}

From source file:org.sonar.java.checks.SelectorMethodArgumentCheck.java

private static List<Symbol> getBooleanParametersAsSymbol(List<VariableTree> parameters) {
    List<Symbol> booleanParameters = Lists.newLinkedList();
    for (VariableTree variableTree : parameters) {
        if (isBooleanVariable(variableTree)) {
            booleanParameters.add(variableTree.symbol());
        }//from   w  ww  .jav  a2 s  .c om
    }
    return booleanParameters;
}

From source file:exec.validate_evaluation.categorized.MicroCommitIoExtension.java

public Set<List<MicroCommit>> readZipAndSortByLocation(String zip, ICoReTypeName type) {
    Map<ICoReMethodName, List<MicroCommit>> locations = Maps.newHashMap();
    for (MicroCommit mc : contents.get(zip)) {
        if (type.equals(mc.getType())) {
            ICoReMethodName ctx = mc.getMethodContext();
            List<MicroCommit> mcs = locations.get(ctx);
            if (mcs == null) {
                mcs = Lists.newLinkedList();
                locations.put(ctx, mcs);
            }/*www .  j a v a 2 s.  c o  m*/
            mcs.add(mc);
        }
    }
    return Sets.newHashSet(locations.values());
}

From source file:com.puppetlabs.geppetto.ruby.jrubyparser.RubyCallFinder.java

public GenericCallNode findCall(Node root, String... qualifiedName) {
    if (qualifiedName.length < 1)
        throw new IllegalArgumentException("qualifiedName can not be empty");

    this.stack = Lists.newLinkedList();
    this.nameStack = Lists.newLinkedList();

    // OLD CODE, NOW FIXED
    // opportunity to make this better if guava a.k.a google.collect
    // 2.0 is used
    // since it has a Lists.reverse method - now this ugly construct is
    // used./*from  w w w. j  a va 2 s  . c om*/
    // OLD CODE
    // this.qualifiedName = Lists.newArrayList(Iterables.reverse(Lists
    // .newArrayList(qualifiedName)));
    this.qualifiedName = Lists.reverse(Lists.newArrayList(qualifiedName));

    List<GenericCallNode> result = findCallInternal(root, true);
    return result == null || result.size() != 1 ? null : result.get(0);
}