Example usage for java.util ArrayList size

List of usage examples for java.util ArrayList size

Introduction

In this page you can find the example usage for java.util ArrayList size.

Prototype

int size

To view the source code for java.util ArrayList size.

Click Source Link

Document

The size of the ArrayList (the number of elements it contains).

Usage

From source file:y.graphs.ChartHelperELF.java

private static TimeSeriesCollection createDataset(ElfValue[][] dayvalues, int[] mediane,
        boolean[] medianevalide, int med_max, Config config, ArrayList<ConfigSerie> series) {
    final TimeSeries[] aserie = new TimeSeries[series.size()];
    for (int i = 0; i < aserie.length; i++)
        aserie[i] = new TimeSeries(series.get(i).getName());

    for (int d = 0; d < dayvalues.length; d++) {
        final ElfValue[] day = dayvalues[d];

        for (int i = 0; i < day.length; i++) {
            final ElfValue value = day[i];
            final DateTime time = value.getTime();

            final RegularTimePeriod date = new Minute(time.toDate());

            if (value.isValid())
                for (int aix = 0; aix < aserie.length; aix++)
                    series.get(aix).add(aserie[aix], date, value.getValue(), mediane[d], medianevalide[d],
                            mediane[med_max]);
        }//from ww w . j  a  v  a2 s.  c om
    }

    final TimeSeriesCollection dataset = new TimeSeriesCollection();

    for (int aix = 0; aix < aserie.length; aix++)
        dataset.addSeries(aserie[aix]);

    return dataset;
}

From source file:com.topsoft.botspider.io.UnionData.java

public static void setParseClass(Job job, Class[] parseClass) {
    if (job == null || parseClass == null)
        return;//w ww  .  j  av a  2  s.c om
    ArrayList<String> arrParse = new ArrayList<String>(parseClass.length);
    for (Class clzss : parseClass) {
        arrParse.add(clzss.getName());
    }
    job.getConfiguration().setStrings(UNION_CLASS, arrParse.toArray(new String[arrParse.size()]));
}

From source file:com.libresoft.apps.ARviewer.Utils.GeoNames.AltitudeManager.java

public static void updateHeights(ArrayList<ARGeoNode> resources_list) {
    if (resources_list == null)
        return;//from   w  w  w.j  a va2s. com
    int length = resources_list.size();
    for (int i = (length - 1); i > -1; i--) {
        GeoNode resource = resources_list.get(i).getGeoNode();
        if (resource.getAltitude() == NO_ALTITUDE_VALUE)
            resource.setAltitude((float) getAltitudeFromLatLong((float) (double) resource.getLatitude(),
                    (float) (double) resource.getLongitude()));
    }
}

From source file:com.acceleratedio.pac_n_zoom.DrawSVG.java

public static void ld_pth_pnts(ArrayList<Integer[]> pnts, Path path) {

    int pnt_nmbr = pnts.size();
    Integer[] crt_pnt = pnts.get(0);
    path.moveTo(crt_pnt[0], crt_pnt[1]);

    // Loop through the points of a path
    for (int pnt_mbr = 1; pnt_mbr < pnt_nmbr; pnt_mbr += 1) {

        crt_pnt = pnts.get(pnt_mbr);/*from www .  j  a va 2 s  .  co m*/
        path.lineTo(crt_pnt[0], crt_pnt[1]);
    }
}

From source file:com.passwdmanager.formats.JSONManager.java

public static String makeFile(String username, ArrayList<PasswdResource> passwords) {
    String data = "{ \n\t\"username\": \"" + username + "\", \n";
    data += "\t\"sites\": [";

    int max = passwords.size();
    for (int i = 0; i < max; i++) {
        PasswdResource pr = passwords.get(i);
        if (i > 0)
            data += ", ";
        data += "\n\t\t{";
        data += "\t\t\t\"sitename\": \"" + pr.getSite() + "\", \n";
        data += "\t\t\t\"name\": \"" + pr.getName() + "\", \n";
        data += "\t\t\t\"password\": \"" + pr.getPassword();
        if (pr.getNote() != null)
            data += "\", \n\t\t\t\"note\": \"" + pr.getNote() + "\"\n";
        else//ww  w .j  a  v  a 2s  .  c om
            data += "\"\n";
        data += "\t\t}";
    }

    data += "\n\t]\n";
    data += "}";
    return data;
}

From source file:adept.utilities.Grapher.java

/**
 * Make heap usage graph./*from w ww . jav a  2  s  .com*/
 *
 * @param values the values
 * @param filename the filename
 */
public static void makeHeapUsageGraph(ArrayList<Double> values, File filename) {
    try {
        DefaultCategoryDataset line_chart_dataset = new DefaultCategoryDataset();
        for (int i = 1; i <= values.size(); i++) {
            line_chart_dataset.addValue(values.get(i - 1), "MB", "" + i);
        }

        /* Step -2:Define the JFreeChart object to create line chart */
        JFreeChart lineChartObject = ChartFactory.createLineChart("Heap Memory Usage", "Run Number",
                "Heap Memory Used", line_chart_dataset, PlotOrientation.VERTICAL, true, true, false);

        /* Step -3 : Write line chart to a file */
        int width = 640; /* Width of the image */
        int height = 480; /* Height of the image */
        ChartUtilities.saveChartAsPNG(filename, lineChartObject, width, height);
    }

    catch (Exception e) {
        e.printStackTrace();
    }

}

From source file:com.tmobile.TMobileParsing.java

protected static List<Subscription> parseSubscriptions(JsonObject jsonSubscriptions) {
    List<Subscription> subscriptions = new ArrayList<>();

    Set<Map.Entry<String, JsonElement>> keys = jsonSubscriptions.entrySet();
    ArrayList<Map.Entry<String, JsonElement>> subscriptionIds = new ArrayList<>(keys);

    for (int i = 0; i < subscriptionIds.size(); i++) {
        String subscriptionId = subscriptionIds.get(0).getKey();

        JsonObject jsonSubscription = jsonSubscriptions.get(subscriptionId).getAsJsonObject();

        Subscription subscription = new Subscription();
        subscription.setPhoneNumber(subscriptionId);
        subscription.setCallUsageLink(jsonSubscription.get("callUsageLink").getAsString());
        subscription.setContractEndDate(jsonSubscription.get("contractEndDate").getAsString());
        subscription.setDataUsageLink(jsonSubscription.get("dataUsageLink").getAsString());
        subscription.setInfoLink(jsonSubscription.get("infoLink").getAsString());
        subscription.setPaymentType(jsonSubscription.get("paymentType").getAsString());
        subscription.setTariffName(jsonSubscription.get("tariffName").getAsString());
        subscription.setTrafficSOC(jsonSubscription.get("tariffSOC").getAsString());
        subscription.setThirdPartyUsageLink(jsonSubscription.get("thirdPartyUsageLink").getAsString());

        subscriptions.add(subscription);
    }/*from  w  w  w .  j ava2 s  .c  om*/

    return subscriptions;
}

From source file:com.brienwheeler.lib.svc.impl.ServiceBaseTestUtil.java

@SuppressWarnings("unchecked")
public static void verifySubServiceCount(StartableServiceBase service, int subServiceCount) {
    ArrayList<IStartableService> svcRefCount = (ArrayList<IStartableService>) ReflectionTestUtils
            .getField(service, "subServices");
    Assert.assertEquals(subServiceCount, svcRefCount.size());
}

From source file:com.tmobile.TMobileParsing.java

protected static List<Profile> parseProfiles(JsonObject jsonProfiles) {
    List<Profile> profiles = new ArrayList<>();

    Set<Map.Entry<String, JsonElement>> keys = jsonProfiles.entrySet();
    ArrayList<Map.Entry<String, JsonElement>> profileIds = new ArrayList<>(keys);

    for (int i = 0; i < profileIds.size(); i++) {
        String profileId = profileIds.get(i).getKey();
        JsonObject jsonProfile = jsonProfiles.get(profileId).getAsJsonObject();
        String roleName = jsonProfile.get("roleName").getAsString();

        Profile profile = new Profile();
        profile.setId(profileId);/*from  w  ww .  j a v  a  2 s  . c om*/
        profile.setRoleName(roleName);

        //Process billing account
        BillingAccount billingAccount = extractBillingAccount(jsonProfile);
        profile.setBillingAccount(billingAccount);
        //End of billing account

        //Process balance
        JsonObject jsonBillingAccount = jsonProfile.getAsJsonObject("billingAccount");

        Balance balance = extractBalance(jsonBillingAccount);
        billingAccount.setBalance(balance); //Set it in the billing account
        //End of balance

        //Process subscriptions
        List<Subscription> subscriptions = parseSubscriptions(
                jsonBillingAccount.getAsJsonObject("subscriptions"));
        billingAccount.setSubscriptions(subscriptions);
        //End of subscriptions

        profiles.add(profile);
    }

    return profiles;
}

From source file:Main.java

public static ActivityInfo[] getIntentHandlers(Context ctx, Intent intent) {
    List<ResolveInfo> list = ctx.getPackageManager().queryIntentActivities(intent, 0);
    ArrayList<ActivityInfo> activities = new ArrayList<ActivityInfo>();
    if (list != null) {
        for (ResolveInfo ri : list) {
            activities.add(ri.activityInfo);
        }//from   ww w  .  ja v  a  2s . co  m
    }
    return activities.toArray(new ActivityInfo[activities.size()]);
}