Example usage for java.util Collections nCopies

List of usage examples for java.util Collections nCopies

Introduction

In this page you can find the example usage for java.util Collections nCopies.

Prototype

public static <T> List<T> nCopies(int n, T o) 

Source Link

Document

Returns an immutable list consisting of n copies of the specified object.

Usage

From source file:org.um.feri.ears.problems.unconstrained.ProblemRosenbrockD3.java

public ProblemRosenbrockD3() {
    super(3, 0);//  w w  w  . j a  va  2 s.co  m

    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, -1.2));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 1.2));

    name = "Rosenbrock d3";
}

From source file:org.um.feri.ears.problems.unconstrained.ProblemRosenbrockD2a.java

public ProblemRosenbrockD2a() {
    super(2, 0);/*from w  w w . ja v a2 s. c  o  m*/

    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, -1.2));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 1.2));

    name = "Rosenbrock d2a";
}

From source file:org.um.feri.ears.problems.unconstrained.ProblemRosenbrockD2b.java

public ProblemRosenbrockD2b() {
    super(2, 0);//ww  w .  j av  a2  s  .co  m

    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, -10.0));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 10.0));

    name = "Rosenbrock d2b";
}

From source file:org.um.feri.ears.problems.unconstrained.ProblemSchwefelRidge.java

public ProblemSchwefelRidge(int d) {
    super(d, 0);//www.  ja v a  2  s  .  c o  m

    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, -64.0));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 64.0));

    name = "Schwefel Rigle (" + d + ")";
}

From source file:org.um.feri.ears.problems.unconstrained.ProblemRosenbrock.java

public ProblemRosenbrock(int d) {
    super(d, 0);/*from w  w  w .  j ava 2  s .  c  o  m*/

    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, -30.0));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 30.0));

    name = "Rosenbrock";
}

From source file:org.commonreality.participant.impl.RequestableEfferentCommandManager.java

/**
 * //w  ww .j  a v a2s .c  om
 */
public RequestableEfferentCommandManager(IParticipant participant) {
    _participant = participant;
    _delegate = new RequestableObjectManagerDelegate(participant, 5) {

        @Override
        protected Collection<? extends IIdentifier> createTemplates(Object key) {
            return Collections.nCopies(10, new BasicSensoryIdentifier("", IIdentifier.Type.EFFERENT_COMMAND,
                    _participant.getIdentifier(), (IIdentifier) key, _participant.getIdentifier()));
        }

        @Override
        protected Object getKey(IIdentifier freeIdentifier) {
            if (freeIdentifier.getType() != IIdentifier.Type.EFFERENT_COMMAND)
                return null;
            return ((ISensoryIdentifier) freeIdentifier).getSensor();
        }

    };
}

From source file:org.um.feri.ears.problems.unconstrained.ProblemAckley.java

public ProblemAckley(int d) {
    super(d, 0);/*  w  w w  .j  a  v a 2 s .  co  m*/

    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, -32.0));
    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 32.0));

    name = "Ackley";
}

From source file:com.facebook.presto.operator.aggregation.AbstractTestApproximateCountDistinct.java

@Test(dataProvider = "provideStandardErrors")
public void testAllPositionsNull(double maxStandardError) throws Exception {
    assertCount(Collections.nCopies(100, null), maxStandardError, 0);
}

From source file:org.um.feri.ears.problems.constrained.TLBOBenchmarkFunction5.java

public TLBOBenchmarkFunction5() {
    super(3, 0);/*  w w  w .  jav  a2s.c o  m*/
    minimum = false;

    upperLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0));
    lowerLimit = new ArrayList<Double>(Collections.nCopies(numberOfDimensions, 0.0));
    Collections.fill(lowerLimit, 0.0);
    Collections.fill(upperLimit, 10.0);

    //System.out.println(Arrays.toString(interval)+"\n"+Arrays.toString(intervalL));
    name = "TLBOBenchmarkFunction5 (TP11)";

}

From source file:org.apache.hadoop.hive.hbase.HBaseLazyObjectFactory.java

public static ObjectInspector createLazyHBaseStructInspector(HBaseSerDeParameters hSerdeParams, Properties tbl)
        throws SerDeException {
    List<TypeInfo> columnTypes = hSerdeParams.getColumnTypes();
    ArrayList<ObjectInspector> columnObjectInspectors = new ArrayList<ObjectInspector>(columnTypes.size());
    for (int i = 0; i < columnTypes.size(); i++) {
        if (i == hSerdeParams.getKeyIndex()) {
            columnObjectInspectors//from w  ww  . j av  a  2s  .  c o  m
                    .add(hSerdeParams.getKeyFactory().createKeyObjectInspector(columnTypes.get(i)));
        } else {
            columnObjectInspectors.add(
                    hSerdeParams.getValueFactories().get(i).createValueObjectInspector(columnTypes.get(i)));
        }
    }
    List<String> structFieldComments = StringUtils.isEmpty(tbl.getProperty("columns.comments"))
            ? new ArrayList<>(Collections.nCopies(columnTypes.size(), ""))
            : Arrays.asList(tbl.getProperty("columns.comments").split("\0", columnTypes.size()));

    return LazyObjectInspectorFactory.getLazySimpleStructObjectInspector(hSerdeParams.getColumnNames(),
            columnObjectInspectors, structFieldComments, hSerdeParams.getSerdeParams().getSeparators()[0],
            hSerdeParams.getSerdeParams(), ObjectInspectorOptions.JAVA);
}