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.jasper.analytics.DataSourceUtils.java

public static ColumnValuesDataSource toDs(Table<Integer, String, Double> table) {
    String columnNames[] = table.columnKeySet().toArray(new String[0]);
    List<ColumnValues> columnValues = Lists.newLinkedList();
    int numRows = table.rowKeySet().size();

    // Rebuild all of the columns
    for (String columnName : columnNames) {
        if ("Timestamp".equalsIgnoreCase(columnName)) {
            // Always convert the Timestamp column to Date objects
            Object[] values = new Date[numRows];
            for (int i = 0; i < numRows; i++) {
                values[i] = new Date(table.get(i, columnName).longValue());
            }//  w w w  . ja v  a 2s .  c  o m
            columnValues.add(new ObjectArrayValues(values));
        } else {
            // Leave every other column as doubles
            double[] values = new double[numRows];
            for (int i = 0; i < numRows; i++) {
                Double value = table.get(i, columnName);
                // Convert any nulls to NaNs, avoids NPEs
                if (value != null) {
                    values[i] = value;
                } else {
                    values[i] = Double.NaN;
                }
            }
            columnValues.add(new DoubleArrayValues(values));
        }
    }

    // Join the columns into a data source
    return new ColumnValuesDataSource(columnNames, numRows, columnValues.toArray(new ColumnValues[0]));
}

From source file:com.github.lburgazzoli.karaf.common.cmd.AbstractCommand.java

/**
 * c-tor
 */
public AbstractCommand() {
    m_serviceReferences = Lists.newLinkedList();
}

From source file:com.googlesource.gerrit.plugins.hooks.workflow.Rule.java

@Inject
public Rule(@Assisted String name) {
    this.name = name;
    this.actionRequests = Lists.newLinkedList();
    this.conditions = Sets.newHashSet();
}

From source file:org.jalphanode.config.PropertiesType.java

/**
 * Initializes internal structure.
 */
public PropertiesType() {
    this.property = Lists.newLinkedList();
}

From source file:presto.android.xml.AndroidView.java

@Override
public IAndroidView deepCopy() {
    AndroidView res = new AndroidView();
    // <src, tgt>
    LinkedList<Pair<AndroidView, AndroidView>> work = Lists.newLinkedList();
    work.add(new Pair<AndroidView, AndroidView>(this, res));

    while (!work.isEmpty()) {
        Pair<AndroidView, AndroidView> p = work.remove();
        AndroidView src = p.getO1();/* w  ww .j a va 2 s.  com*/
        AndroidView tgt = p.getO2();
        tgt.klass = src.klass;
        tgt.id = src.id;
        tgt.text = src.text;
        tgt.origin = src.origin;

        int sz = src.getNumberOfChildren();
        for (int i = 0; i < sz; ++i) {
            IAndroidView newSrc = src.getChildInternal(i);
            if (newSrc instanceof IncludeAndroidView) {
                IAndroidView newTgt = newSrc.deepCopy();
                newTgt.setParent(tgt);
            } else {
                AndroidView newTgt = new AndroidView();
                newTgt.setParent(tgt);
                work.add(new Pair<AndroidView, AndroidView>((AndroidView) newSrc, newTgt));
            }
        }
    }

    return res;
}

From source file:com.cloudera.nav.sdk.model.MClassUtil.java

private static Collection<Field> getValidFields(Class<?> mclass, Class<? extends Annotation> annClass) {
    Collection<Field> fields = Lists.newLinkedList();
    for (Field field : mclass.getDeclaredFields()) {
        if (!field.isSynthetic() && field.isAnnotationPresent(annClass)) {
            fields.add(field);/*from www  . j  a v a  2s.  co m*/
        }
    }
    Class<?> superClass = mclass.getSuperclass();
    if (superClass != null) {
        fields.addAll(getValidFields(superClass, annClass));
    }
    return fields;
}

From source file:no.ssb.vtl.script.visitors.StartVisitor.java

@Override
protected LinkedList<Dataset> defaultResult() {
    return Lists.newLinkedList();
}

From source file:yaphyre.scenereaders.yaphyre.utils.TransformationEntityHelper.java

@Override
public Transformation decodeEntity(Match entityMatch) {
    Deque<Transformation> transformationStack = Lists.newLinkedList();
    for (Match transformationMatch : entityMatch.children().each()) {
        transformationStack.push(decodeSingleTransformation(transformationMatch));
    }//from  ww  w .ja  v a2  s  .c  o m
    Transformation result = Transformation.IDENTITY;
    while (!transformationStack.isEmpty()) {
        result = result.mul(transformationStack.pop());
    }
    return result;
}

From source file:com.enonic.cms.core.portal.rendering.tracing.RenderTraceHistory.java

@Override
public void readExternal(final ObjectInput in) throws IOException, ClassNotFoundException {
    this.history = Lists.newLinkedList();
}

From source file:com.google.jstestdriver.coverage.InstrumentedCode.java

public void writeInitialLines(CoverageAccumulator accumulator) {
    List<CoveredLine> initialLines = Lists.newLinkedList();
    for (Integer lineNumber : executableLines) {
        initialLines.add(new CoveredLine(lineNumber, 0));
    }//from ww w.  j a v a 2  s  .c  om
    accumulator.add("<initial lines>", Lists.newArrayList(new FileCoverage(fileId, initialLines)));
}