List of usage examples for java.util ArrayList size
int size
To view the source code for java.util ArrayList size.
Click Source Link
From source file:com.testlinkrestapi.util.BeanUtils.java
/** * @param ArrayList<TestProjectBean>,ArrayList<TestProjectBean> * @return TestProjectBean./* w w w . jav a 2 s . co m*/ */ public static final TestProjectBean getDeltaTestProject(ArrayList<TestProjectBean> before, ArrayList<TestProjectBean> after) { TestProjectBean bean = new TestProjectBean(); int detla = after.size() - before.size(); if (detla == 1) { bean = after.get(after.size() - 1); } return bean; }
From source file:eu.eexcess.partnerdata.evaluation.enrichment.PartnerRecommenderEvaluationTestHelper.java
static public void testService(String serviceName) { ArrayList<String> keywords = PartnerRecommenderEvaluationTestHelper.readKeywords(); for (int i = 0; i < keywords.size(); i++) { ArrayList<String> keyword = new ArrayList<String>(); keyword.add(keywords.get(i));/*from w w w.j a va2 s . co m*/ ResultList resultList = PartnerRecommenderEvaluationTestHelper.getRecommendations( "eexcess-partner-" + serviceName + "-1.0-SNAPSHOT", port, PartnerRecommenderEvaluationTestHelper.createParamsForPartnerRecommender(20, keyword)); System.out.print(" " + i); } }
From source file:Main.java
private static String listToString(ArrayList<String> pathSpec) { if (pathSpec.isEmpty()) return ""; StringBuilder ret = new StringBuilder(); ret.append(pathSpec.get(0));// w ww . j a va2s .c o m for (int i = 1, n = pathSpec.size(); i < n; i++) ret.append(File.separator).append(pathSpec.get(i)); return ret.toString(); }
From source file:com.sm.test.TestError.java
public static void testSplit() { ArrayList<String> list = new ArrayList<String>(Arrays.asList("1", "2", "3", "4", "5")); ArrayList<String> alist = new ArrayList<String>(Arrays.asList("1", "2", "3")); int j = list.size(); list.removeAll(alist);// www. j a v a 2s . c om System.out.println(list.toString() + " alist " + alist); String strToBytes = "strToBytes(\"00005d29e7918b7c9460a4c8496b8640\")"; String[] splits = strToBytes.split("\""); System.out.println(splits[1].getBytes()); }
From source file:dk.statsbiblioteket.doms.licensemodule.solr.AbstractSolrJClient.java
public static String makeAuthIdPart(ArrayList<String> ids) { StringBuilder queryIdPart = new StringBuilder(); queryIdPart.append("("); for (int i = 0; i < ids.size(); i++) { String id = ids.get(i);/*from w w w.j a v a 2 s .com*/ //Remove all \ and " from the string id = id.replaceAll("\\\\", ""); id = id.replaceAll("\\\"", ""); queryIdPart.append(filterField + ":\"" + id + "\""); if (i < ids.size() - 1) { queryIdPart.append(" OR "); } } queryIdPart.append(")"); return queryIdPart.toString(); }
From source file:Main.java
private static void zipDir(String dir, ZipOutputStream out) throws IOException { File directory = new File(dir); URI base = directory.toURI(); ArrayList<File> filesToZip = new ArrayList<File>(); GetFiles(directory, filesToZip);//from w w w .ja v a 2 s . c om for (int i = 0; i < filesToZip.size(); ++i) { FileInputStream in = new FileInputStream(filesToZip.get(i)); String name = base.relativize(filesToZip.get(i).toURI()).getPath(); out.putNextEntry(new ZipEntry(name)); byte[] buf = new byte[4096]; int bytes = 0; while ((bytes = in.read(buf)) != -1) { out.write(buf, 0, bytes); } out.closeEntry(); in.close(); } out.finish(); out.flush(); }
From source file:helpers.Plots.java
public static void plotSimpleLineXY(ArrayList<double[][]> data, ArrayList<String> seriesName, String title, String xname, String yname) { DefaultXYDataset ds = new DefaultXYDataset(); for (int i = 0; i < data.size(); i++) { System.out.println(data.get(i)[0][0]); ds.addSeries(seriesName.get(i), data.get(i)); }//from w w w. j a va2 s .com JFreeChart chart = ChartFactory.createXYLineChart(title, xname, yname, ds, PlotOrientation.VERTICAL, true, true, false); ChartFrame frame = new ChartFrame(title, chart); frame.pack(); frame.setVisible(true); }
From source file:Interface.Camembert.java
public static JPanel cCamembert(JFrame f, ArrayList<ArrayList> liste) { // On rcupre les 2 listes ArrayList<Integer> nb = liste.get(1); ArrayList<String> nom = liste.get(2); DefaultPieDataset pieDataset = new DefaultPieDataset(); for (int i = 0; i < nb.size(); i++) { pieDataset.setValue(nom.get(i) + " : " + nb.get(i), nb.get(i)); }/*www . ja v a2s . c o m*/ JFreeChart pieChart = ChartFactory.createPieChart("Nombre d'interventions par mdecin", pieDataset, true, true, true); ChartPanel cPanel = new ChartPanel(pieChart); return cPanel; }
From source file:TestMapObjInterface.java
public static boolean runTest(String file, String fsName, String cnaddress) { try {/*from www . ja v a 2s.co m*/ long targetNumChunks = 2; FileWriter godot = new FileWriter(file); File monet = new File(file); godot.write("I'm waiting."); godot.flush(); while ((monet.length() / CHUNK_SIZE + 1) < targetNumChunks) { godot.write("I'm waiting."); } godot.flush(); godot.close(); ArrayList<String> chunks = getChunks(file, fsName, cnaddress); long fileChunks = (monet.length() / CHUNK_SIZE) + 1; if (fileChunks == chunks.size()) { return true; } else { System.out.print("expected " + fileChunks + " chunks, got " + chunks.size() + ": "); return false; } } catch (Exception e) { return false; } }
From source file:challenge302.intermediate.ASCIIHistogramMaker.java
private static void printChart(IntBasedBarChart c, int size) { ArrayList<int[]> data = c.getData(); if (data.size() == size) { //what is the step between elements int step = ((c.getBounds().getMaxX() - c.getBounds().getMinX()) / size); //find the MAX # of chars for each entry in the chart //if chart starts at 0 and goes to 100, the step should be 3 chars int charStep = String.valueOf(c.getMaxX()).length(); char chartChar = '*'; int numColumns = ((size + 1) * (charStep + 1)); // System.out.println("MinY="+c.getMinY()); // System.out.println("MaxY="+c.getMaxY()); // System.out.println("MinX="+c.getMinX()); // System.out.println("MaxX="+c.getMaxX()); // System.out.println("number of X columns="+numColumns); //chreate a 2D char array to store the final barChart //the height is the difference between maxX-minX +1 (for x axis labels) // char[][] graph = new char[c.getMaxX()-c.getMinX()+1] // //and the width of the chart is the charStep // [(charStep+1)*size]; int yAxisCharMax = String.valueOf(c.getMaxY()).length(); //print the x axis guide significant digit // System.out.print(StringUtils.repeat(" ", yAxisCharMax)); // for(int i=1;i<numColumns;i++){ // if(i/10 >0) // System.out.print(i/10); // else // System.out.print(" "); // } // System.out.println("|"); //print the x axis guide // System.out.print(StringUtils.repeat(" ", yAxisCharMax)); // for(int i=1;i<numColumns;i++){ // System.out.print(i%10); // } // System.out.println("|"); ////from w w w . j a v a 2 s.c om //print if this column is a printing column // System.out.print(StringUtils.repeat(" ", yAxisCharMax)); // for(int i=1;i<numColumns;i++){ // if(i % (charStep+1) == 0 && i >0) // System.out.print("p"); // else // System.out.print(" "); // } // System.out.println("|"); // for (int y = c.getMaxY(); y >= c.getMinY(); y--) { System.out.print(String.format("%0" + yAxisCharMax + "d", y)); int maxX = 0; for (int x = 1; x < numColumns; x++) { //need to find if the current column is a printing column if (x % (charStep + 1) == 0 && x > 0) { //calc the current column in the data, check the value //if the data value is <= current y axis, print chartChar if (y <= data.get(x / (charStep + 1) - 1)[2]) { System.out.print(chartChar); } else {//Y is > data value, so print space System.out.print(" "); } } else {//not a printing column, print space System.out.print(" "); } maxX = x; } //end looping through x Axis //print newline at the end of the X axis on this level of Y axis System.out.println();//end the printed line } //end of loop on data // //print if this column is a printing column // System.out.print(StringUtils.repeat(" ", yAxisCharMax)); // for(int i=1;i<numColumns;i++){ // if(i % (charStep+1) == 0 && i >0) // System.out.print("p"); // else // System.out.print(" "); // } // System.out.println("|"); // //print the X axis System.out.print(StringUtils.repeat(" ", yAxisCharMax)); for (int[] d : c.getData()) { System.out.print(String.format("%0" + String.valueOf(c.getMaxX()).length() + "d", d[0]) + " "); } System.out.println(String.valueOf(c.getMaxX())); } //the data we got returned is the expected size else { System.out.println("ERROR: data size \"" + data.size() + "\" is !=" + size); } }