Example usage for java.util List addAll

List of usage examples for java.util List addAll

Introduction

In this page you can find the example usage for java.util List addAll.

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

Usage

From source file:elaborate.util.StringUtil.java

public static String pageTitle(String... subtitles) {
    List<String> parts = Lists.newArrayList(APPNAME);
    parts.addAll(Lists.newArrayList(subtitles));
    return Joiner.on(PAGETITLESEPARATOR).join(parts);
}

From source file:com.digitalbridge.domain.geo.GeoJsonPolygon.java

private static List<Point> asList(Point first, Point second, Point third, Point fourth, final Point... others) {

    List<Point> result = new ArrayList<Point>(Constants.THREE + others.length);

    result.add(first);//from  w ww  .  ja  v  a 2 s .com
    result.add(second);
    result.add(third);
    result.add(fourth);
    result.addAll(Arrays.asList(others));

    return result;
}

From source file:kjscompiler.Program.java

private static void run() throws ParseException, IOException, NullPointerException {
    Settings settings = new Settings(settingsPath);

    System.out.println("Searching for " + settings.getPattern() + " in " + settings.getBaseDir());

    JSONArray Base = settings.getBaseDir();
    List<String> files = new ArrayList<String>();
    for (int i = 0; i < Base.size(); i++) {
        files.addAll(FileScanner.run((String) Base.get(i), settings.getPattern(), settings.getProjectPath()));
    }/* w ww  .  jav  a 2s .c  o  m*/
    System.out.println("Found " + files.size() + " files");

    List<FileInfo> fiPrimaries = new ArrayList<FileInfo>();
    List<String> pExternals = new ArrayList<String>();

    Hashtable<String, Integer> fiHtPrimaries = new Hashtable<String, Integer>();

    for (String fullpath : files) {
        FileInfo fi = new FileInfo(fullpath);

        if (!fi.getIsIgnore()) {

            if (fi.getIsExternal()) {
                pExternals.add(fi.getFilename());
            } else {
                fiPrimaries.add(fi);
            }
        }
    }

    System.out.println("Primaries: " + fiPrimaries.size() + " files");
    System.out.println("Externals: " + pExternals.size() + " files");

    OrderDeps od = new OrderDeps(fiPrimaries);
    List<FileInfo> ordered = od.getOrderedFiles();
    List<String> oErrors = od.getErrors();

    for (int i = 0, length = oErrors.size(); i < length; i++) {
        String err = oErrors.get(i);
        System.out.println("Order Error #" + (i + 1) + ": " + err);
    }

    System.out.println("Primaries ordered");

    List<String> pPrimaries = new ArrayList<String>();

    for (int i = 0, length = ordered.size(); i < length; i++) {
        pPrimaries.add(ordered.get(i).getFilename());
    }

    String compilationLevel = settings.getLevel();

    GoogleClosureCompiler compiler = new GoogleClosureCompiler(pPrimaries, settings.getOutput(),
            compilationLevel, pExternals);
    compiler.setWrapper(settings.getWrapper());
    compiler.setWarningLevel(WarningLevel.VERBOSE);
    compiler.run();
    System.out.println("Compiled file: " + settings.getOutput());

    JSError[] errors = compiler.getErrors();
    for (int i = 0, length = errors.length; i < length; i++) {
        JSError err = errors[i];
        System.out.println("Error #" + (i + 1) + ": " + err.description + " in " + err.sourceName + " ("
                + err.lineNumber + ")");
    }
    if (errors.length == 0) {
        JSError[] warnings = compiler.getWarnings();
        for (int i = 0, length = warnings.length; i < length; i++) {
            JSError warn = errors[i];
            System.out.println("Warning #" + (i + 1) + ": " + warn.description + " in " + warn.sourceName + " ("
                    + warn.lineNumber + ")");
        }
    }

    System.out.println("\n\n Thank you for using kJScompiler!\n Who said JavaScript can't be compiled?\n");

    System.exit(0);
}

From source file:com.nortal.petit.beanmapper.BeanMappingReflectionUtils.java

private static void addAll(List<Annotation> l, Annotation[] ans) {
    if (ans != null) {
        for (Annotation a : ans) {
            if (a instanceof AttributeOverrides) {
                l.addAll(Arrays.asList(((AttributeOverrides) a).value()));
            } else {
                l.add(a);// w ww  .  j  a v  a2 s .  c o  m
            }
        }
    }
}

From source file:com.ponysdk.spring.ProxyBuilderGenerator.java

private static List<File> read(final File f) {
    final List<File> files = new ArrayList<File>();
    if (f.isDirectory()) {
        final File[] childs = f.listFiles();
        for (final File child : childs) {
            files.addAll(read(child));
        }//from   w  w w .  j  av a2  s .c  o m
    } else {
        if (f.getName().endsWith(".pony.xml")) {
            files.add(f);
        }
    }
    return files;
}

From source file:net.sourceforge.vulcan.maven.MavenBuildPlugin.java

@SuppressWarnings("unchecked")
static URL[] createURLs(String mavenHomeDirectory) throws ConfigException {
    final String[] extensions = new String[] { "jar" };

    try {//  w  w  w . j av a 2 s. co m
        final List<File> files = new ArrayList<File>();

        files.addAll(FileUtils.listFiles(new File(mavenHomeDirectory), extensions, true));

        final URL[] urls = new URL[files.size() + 1];

        for (int i = 0; i < files.size(); i++) {
            urls[i] = files.get(i).toURI().toURL();
        }

        urls[urls.length - 1] = MavenBuildTool.getLocalClassPathEntry(MavenBuildPlugin.class, null).toURI()
                .toURL();

        return urls;
    } catch (MalformedURLException e) {
        throw new RuntimeException(e);
    }
}

From source file:com.yunmel.syncretic.utils.commons.CollectionsUtils.java

/**
 * a+bList.//from  w  w w.jav a2  s. c o m
 */
public static <T> List<T> union(final Collection<T> a, final Collection<T> b) {
    List<T> result = Lists.newArrayList(a);
    result.addAll(b);
    return result;
}

From source file:eu.eubrazilcc.lvl.storage.security.PermissionHelper.java

public static final String asOAuthString(final String... permissions) {
    final List<String> collection = newArrayList();
    if (permissions != null && permissions.length > 0) {
        collection.addAll(asList(permissions));
    }// ww  w  .j  a  v  a2s .  co  m
    return asOAuthString(collection);
}

From source file:net.bither.model.Depth.java

public static Depth formatJsonOfMarketDepth(MarketType marketType, JSONObject json) throws JSONException {
    Depth depth = new Depth();

    double rate = ExchangeUtil.getRate(marketType);
    int bidMaxPrice = 0;
    int askMinPrice = Integer.MAX_VALUE;

    List<DateValueEntity> bidDateValueEntities = new ArrayList<DateValueEntity>();
    List<DateValueEntity> askDateValueEntities = new ArrayList<DateValueEntity>();
    double bidSumVolume = 0;
    int splitIndex = 0;
    if (!json.isNull(BIDS)) {
        JSONArray bidArray = json.getJSONArray(BIDS);

        for (int i = bidArray.length() - 1; i >= 0; i--) {
            JSONArray bid = bidArray.getJSONArray(i);
            int bidPrice = bid.getInt(0);
            double price = ((double) bidPrice) / 100 * rate;
            double volume = bid.getDouble(1) / Math.pow(10, 8);
            if (bidMaxPrice < bidPrice) {
                bidMaxPrice = bidPrice;//from w ww  .ja va  2s .co m
            }
            bidSumVolume = bidSumVolume + volume;
            DateValueEntity dateValueEntity = new DateValueEntity((float) bidSumVolume,
                    StringUtil.formatDoubleToMoneyString(price), bidPrice);
            bidDateValueEntities.add(dateValueEntity);

        }
        splitIndex = bidArray.length();

    }
    double askSumVolume = 0;
    if (!json.isNull(ASKS)) {
        JSONArray askArray = json.getJSONArray(ASKS);

        for (int i = 0; i < askArray.length(); i++) {
            JSONArray ask = askArray.getJSONArray(i);
            int askPrice = ask.getInt(0);
            double price = ((double) askPrice) / 100 * rate;
            double volume = ask.getDouble(1) / Math.pow(10, 8);
            askSumVolume = askSumVolume + volume;
            if (askPrice < askMinPrice) {
                askMinPrice = askPrice;
            }
            DateValueEntity dateValueEntity = new DateValueEntity((float) askSumVolume,
                    StringUtil.formatDoubleToMoneyString(price), askPrice);
            askDateValueEntities.add(dateValueEntity);
        }

    }
    int mixPrice = (askMinPrice + bidMaxPrice) / 2;
    DateValueEntity zeroDateValue = new DateValueEntity(0,
            StringUtil.formatDoubleToMoneyString(((double) mixPrice) / 100 * rate), mixPrice);
    List<DateValueEntity> dateValueEntities = new ArrayList<DateValueEntity>();
    dateValueEntities.addAll(bidDateValueEntities);
    dateValueEntities.add(zeroDateValue);
    dateValueEntities.addAll(askDateValueEntities);
    Collections.sort(dateValueEntities, new ComparatorDateValue());
    depth.setMaxVolume(Math.max(askSumVolume, bidSumVolume));
    depth.setDateValueEntities(dateValueEntities);
    depth.setSplitIndex(splitIndex);
    return depth;

}

From source file:net.sourceforge.fenixedu.dataTransferObject.InfoExecutionDegree.java

public static List buildLabelValueBeansForList(List executionDegrees, MessageResources messageResources) {
    List copyExecutionDegrees = new ArrayList();
    copyExecutionDegrees.addAll(executionDegrees);
    List result = new ArrayList();
    Iterator iter = executionDegrees.iterator();
    while (iter.hasNext()) {
        final InfoExecutionDegree infoExecutionDegree = (InfoExecutionDegree) iter.next();
        List equalDegrees = (List) CollectionUtils.select(copyExecutionDegrees, new Predicate() {
            @Override//from  w w w  . ja va 2 s  . c o m
            public boolean evaluate(Object arg0) {
                InfoExecutionDegree infoExecutionDegreeElem = (InfoExecutionDegree) arg0;
                if (infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree().getSigla().equals(
                        infoExecutionDegreeElem.getInfoDegreeCurricularPlan().getInfoDegree().getSigla())) {
                    return true;
                }
                return false;
            }
        });
        if (equalDegrees.size() == 1) {
            copyExecutionDegrees.remove(infoExecutionDegree);

            String degreeType = null;
            if (messageResources != null) {
                degreeType = messageResources.getMessage(infoExecutionDegree.getInfoDegreeCurricularPlan()
                        .getInfoDegree().getDegreeType().toString());
            }
            if (degreeType == null) {
                degreeType = infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree().getDegreeType()
                        .toString();
            }

            result.add(new LabelValueBean(
                    degreeType + "  "
                            + infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree().getNome(),
                    infoExecutionDegree.getExternalId().toString()));
        } else {
            String degreeType = null;
            if (messageResources != null) {
                degreeType = messageResources.getMessage(infoExecutionDegree.getInfoDegreeCurricularPlan()
                        .getInfoDegree().getDegreeType().toString());
            }
            if (degreeType == null) {
                degreeType = infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree().getDegreeType()
                        .toString();
            }

            result.add(
                    new LabelValueBean(
                            degreeType + "  "
                                    + infoExecutionDegree.getInfoDegreeCurricularPlan().getInfoDegree()
                                            .getNome()
                                    + " - " + infoExecutionDegree.getInfoDegreeCurricularPlan().getName(),
                            infoExecutionDegree.getExternalId().toString()));
        }
    }
    return result;

}