List of usage examples for java.util List size
int size();
From source file:com.tomdoel.mpg2dcm.Xml2Dicom.java
public static void main(String[] args) { try {// ww w.j a va2 s . c om final Options helpOptions = new Options(); helpOptions.addOption("h", false, "Print help for this application"); final DefaultParser parser = new DefaultParser(); final CommandLine commandLine = parser.parse(helpOptions, args); if (commandLine.hasOption('h')) { final String helpHeader = "Converts an endoscopic xml and video files to Dicom\n\n"; String helpFooter = "\nPlease report issues at github.com/tomdoel/mpg2dcm"; final HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.printHelp("Xml2Dcm xml-file dicom-output-path", helpHeader, helpOptions, helpFooter, true); } else { final List<String> remainingArgs = commandLine.getArgList(); if (remainingArgs.size() < 2) { throw new org.apache.commons.cli.ParseException("ERROR : Not enough arguments specified."); } final String xmlInputFileName = remainingArgs.get(0); final String dicomOutputPath = remainingArgs.get(1); EndoscopicXmlToDicomConverter.convert(new File(xmlInputFileName), dicomOutputPath); } } catch (org.apache.commons.cli.ParseException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (ParseException e) { e.printStackTrace(); } }
From source file:com.cimpress.puzzle.Main.java
public static void main(final String... args) { logger.debug("tt"); ApplicationContext cntx = new ClassPathXmlApplicationContext("classpath:spring-integration-context.xml"); AsyncLogger asyncLogger = cntx.getBean("asyncLogger", AsyncLogger.class); asyncLogger.log("Container loaded", String.class, Main.class, logger); PuzzleAPI puzzleAPI = cntx.getBean("puzzleAPI", PuzzleAPI.class); DateTime dt = new DateTime(); Puzzle puzzle = puzzleAPI.generatePuzzle(); // new SquareFinder().solvePuzzle(Environment.getPuzzleObject()); List<Square> squareList = new SquareFinder().solvePuzzle(puzzle); System.out.println("Total squares :" + squareList.size()); puzzleAPI.postSolution(squareList, puzzle.getId()); DateTime d2 = new DateTime(); Duration elapsedTime = new Duration(dt, d2); System.out.println("\nTotal Time Taken :" + elapsedTime.getStandardSeconds()); }
From source file:demo.example.ClientCustomContext.java
public final static void main(String[] args) throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); try {//from ww w.ja va 2 s .co m // Create a local instance of cookie store CookieStore cookieStore = new BasicCookieStore(); // Create local HTTP context HttpClientContext localContext = HttpClientContext.create(); // Bind custom cookie store to the local context localContext.setCookieStore(cookieStore); HttpGet httpget = new HttpGet("http://httpbin.org/cookies"); System.out.println("Executing request " + httpget.getRequestLine()); // Pass local context as a parameter CloseableHttpResponse response = httpclient.execute(httpget, localContext); try { System.out.println("----------------------------------------"); System.out.println(response.getStatusLine()); List<Cookie> cookies = cookieStore.getCookies(); for (int i = 0; i < cookies.size(); i++) { System.out.println("Local cookie: " + cookies.get(i)); } EntityUtils.consume(response.getEntity()); } finally { response.close(); } } finally { httpclient.close(); } }
From source file:io.apiman.common.util.ddl.DdlParser.java
@SuppressWarnings("nls") public static void main(String[] args) { String ddl = args[0];// ww w.j av a 2 s .co m File file = new File(ddl); DdlParser parser = new DdlParser(); List<String> list = parser.parse(file); System.out.println("Found " + list.size() + " SQL statements!"); for (String line : list) { System.out.println("--"); System.out.println(line); } }
From source file:com.boonya.http.async.examples.nio.client.AsyncClientCustomContext.java
public final static void main(String[] args) throws Exception { CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault(); try {//from www . j a va 2s . c o m // Create a local instance of cookie store CookieStore cookieStore = new BasicCookieStore(); // Create local HTTP context HttpClientContext localContext = HttpClientContext.create(); // Bind custom cookie store to the local context localContext.setCookieStore(cookieStore); HttpGet httpget = new HttpGet("http://localhost/"); System.out.println("Executing request " + httpget.getRequestLine()); httpclient.start(); // Pass local context as a parameter Future<HttpResponse> future = httpclient.execute(httpget, localContext, null); // Please note that it may be unsafe to access HttpContext instance // while the request is still being executed HttpResponse response = future.get(); System.out.println("Response: " + response.getStatusLine()); List<Cookie> cookies = cookieStore.getCookies(); for (int i = 0; i < cookies.size(); i++) { System.out.println("Local cookie: " + cookies.get(i)); } System.out.println("Shutting down"); } finally { httpclient.close(); } }
From source file:com.lxf.spider.client.ClientCustomContext.java
public final static void main(String[] args) throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); try {/*from w w w . ja v a2s . c om*/ // Create a local instance of cookie store CookieStore cookieStore = new BasicCookieStore(); // Create local HTTP context HttpClientContext localContext = HttpClientContext.create(); // Bind custom cookie store to the local context localContext.setCookieStore(cookieStore); HttpGet httpget = new HttpGet("http://localhost/"); System.out.println("Executing request " + httpget.getRequestLine()); // Pass local context as a parameter CloseableHttpResponse response = httpclient.execute(httpget, localContext); try { System.out.println("----------------------------------------"); System.out.println(response.getStatusLine()); List<Cookie> cookies = cookieStore.getCookies(); for (int i = 0; i < cookies.size(); i++) { System.out.println("Local cookie: " + cookies.get(i)); } EntityUtils.consume(response.getEntity()); } finally { response.close(); } } finally { httpclient.close(); } }
From source file:interoperabilite.webservice.client.ClientCustomContext.java
public final static void main(String[] args) throws Exception { CloseableHttpClient httpclient = HttpClients.createDefault(); try {/* w ww . j av a 2 s . co m*/ // Create a local instance of cookie store CookieStore cookieStore = new BasicCookieStore(); // Create local HTTP context HttpClientContext localContext = HttpClientContext.create(); // Bind custom cookie store to the local context localContext.setCookieStore(cookieStore); HttpGet httpget = new HttpGet("http://httpbin.org/cookies"); System.out.println("Executing request " + httpget.getRequestLine()); // Pass local context as a parameter CloseableHttpResponse response = httpclient.execute(httpget, localContext); try { System.out.println("----------------------------------------"); System.out.println(response.getStatusLine()); List<Cookie> cookies = cookieStore.getCookies(); for (int i = 0; i < cookies.size(); i++) { System.out.println("Local cookie: " + cookies.get(i)); } EntityUtils.consume(response.getEntity()); } finally { response.close(); } } finally { httpclient.close(); } }
From source file:com.sm.replica.TestRClient.java
public static void main(String[] args) { int i = 10;//w w w .j av a2 s .c o m List<String> list = new ArrayList<String>(i); for (int j = 0; j < i; j++) list.add(null); logger.info("freq " + list.size()); String logPath = "/Users/mhsieh/java/open/voldemort-0.81/config/addon-1/data/log"; String store = "test"; CacheStore trxLog = new CacheStore(logPath, null, 0, store, false); ReplicaClient client = new NTReplicaClient("localhost:6910", store, trxLog, logPath); new Thread(client).start(); }
From source file:Main.java
public static void main(String[] args) { List list = new ArrayList(); list.add("1"); list.add("2"); list.add("3"); list.add("java2s.com"); System.out.println("List has:" + list.size()); }
From source file:MainClass.java
public static void main(String[] a) { List list = new LinkedList(); list.add("A"); list.add("B"); list.add("C"); list.add("D"); ListIterator iter = list.listIterator(list.size()); while (iter.hasPrevious()) { System.out.println(iter.previous()); }// www. j av a2s . co m }