List of usage examples for java.util List size
int size();
From source file:com.oreilly.springdata.hadoop.hbase.UserApp.java
public static void main(String[] args) throws Exception { AbstractApplicationContext context = new ClassPathXmlApplicationContext( "/META-INF/spring/application-context.xml", UserApp.class); log.info("HBase Application Running"); context.registerShutdownHook();/*from ww w .ja va 2s .c om*/ UserUtils userUtils = context.getBean(UserUtils.class); userUtils.initialize(); userUtils.addUsers(); UserRepository userRepository = context.getBean(UserRepository.class); List<User> users = userRepository.findAll(); System.out.println("Number of users = " + users.size()); System.out.println(users); }
From source file:sample.fa.ScriptRunnerApplicationMac.java
public static void main(String[] args) { SwingUtilities.invokeLater(() -> { ScriptRunnerApplication app = new ScriptRunnerApplication(); app.createGUI();// www . j av a 2 s . c o m if (args.length > 0) { File f = new File(args[0]); if (f.isFile()) { app.loadScript(f); } } Application.getApplication().setOpenFileHandler((AppEvent.OpenFilesEvent ofe) -> { List<File> files = ofe.getFiles(); if (files != null && files.size() > 0) { app.loadScript(files.get(0)); } }); }); }
From source file:com.apress.prospringintegration.springenterprise.stocks.runner.MainHibernateEntityManager.java
public static void main(String[] args) { GenericApplicationContext context = new AnnotationConfigApplicationContext( "com.apress.prospringintegration.springenterprise.stocks.dao.jpaandentitymanagers"); StockDao stockDao = context.getBean("jpaStockDao", StockDao.class); Stock stock = new Stock("ORAC", "JPAMAIN0001", "QQQQ", 120.0f, 1100, Calendar.getInstance().getTime()); stockDao.insert(stock);/* w w w. j a v a 2s .c o m*/ List<Stock> stocks = stockDao.findAvailableStockBySymbol("ORAC"); if (stocks != null && stocks.size() > 0) { stock = stocks.get(0); System.out.println("Stock Symbol :" + stock.getSymbol()); System.out.println("Inventory Code :" + stock.getInventoryCode()); System.out.println("purchased price:" + stock.getSharePrice()); System.out.println("Exchange ID:" + stock.getExchangeId()); System.out.println("Quantity Available :" + stock.getQuantityAvailable()); } }
From source file:com.apress.prospringintegration.springenterprise.stocks.runner.MainHibernateJPA.java
public static void main(String[] args) { GenericApplicationContext context = new AnnotationConfigApplicationContext( "com.apress.prospringintegration.springenterprise.stocks.dao.jpa"); StockDao stockDao = context.getBean("jpaStockDao", StockDao.class); Stock stock = new Stock("ORAC", "JPAMAIN0001", "QQQQ", 120.0f, 1100, Calendar.getInstance().getTime()); stockDao.insert(stock);//from w ww.ja v a 2 s .com List<Stock> stocks = stockDao.findAvailableStockBySymbol("ORAC"); if (stocks != null && stocks.size() > 0) { stock = stocks.get(0); System.out.println("Stock Symbol :" + stock.getSymbol()); System.out.println("Inventory Code :" + stock.getInventoryCode()); System.out.println("purchased price:" + stock.getSharePrice()); System.out.println("Exchange ID:" + stock.getExchangeId()); System.out.println("Quantity Available :" + stock.getQuantityAvailable()); } }
From source file:uk.ac.ebi.ep.adapter.ebeye.EbeyeRestSearch.java
public static void main(String args[]) { RestTemplate restTemplate = new RestTemplate(); String url = "http://www.ebi.ac.uk/ebisearch/ws/rest/uniprot?query=cancer&format=json&size=20"; EbeyeRestSearch result1 = restTemplate.getForObject(url, EbeyeRestSearch.class); List<EbeyeSearchResult> list = result1.getResults(); System.out.println("List " + list.size()); // ResponseEntity<EbeyeSearchResult> result = restTemplate.exchange(url, // HttpMethod.GET, null, EbeyeSearchResult.class); //EbeyeSearchResult result = restTemplate.getForObject(url, EbeyeSearchResult.class); System.out.println("Obj " + list); for (EbeyeSearchResult result : list) { // System.out.println("Acc: " + result.getAcc()); // System.out.println("Id: " + result.getId()); // System.out.println("Source: " + result.getSource()); }/* ww w. j a v a2 s .com*/ //System.out.println("Entries: " + result1); }
From source file:Main.java
public static void main(String[] argv) throws Exception { List list = new ArrayList(); Object[] objectArray = list.toArray(); MyClass[] array = (MyClass[]) list.toArray(new MyClass[list.size()]); }
From source file:org.seasar.dao.spring.example.EmployeeDaoClient.java
public static void main(final String[] args) { final BeanFactoryLocator locator = ContextSingletonBeanFactoryLocator.getInstance(); final BeanFactoryReference ref = locator.useBeanFactory("context"); final ApplicationContext context = (ApplicationContext) ref.getFactory(); try {/*from w ww .ja va 2 s . co m*/ final EmployeeDao dao = (EmployeeDao) context.getBean("employeeDao"); final List employees = dao.getAllEmployees(); for (int i = 0; i < employees.size(); ++i) { System.out.println(employees.get(i)); } final Employee employee = dao.getEmployee(7788); System.out.println(employee); final int count = dao.getCount(); System.out.println("count:" + count); dao.getEmployeeByJobDeptno(null, null); dao.getEmployeeByJobDeptno("CLERK", null); dao.getEmployeeByJobDeptno(null, new Integer(20)); dao.getEmployeeByJobDeptno("CLERK", new Integer(20)); dao.getEmployeeByDeptno(new Integer(20)); dao.getEmployeeByDeptno(null); System.out.println("updatedRows:" + dao.update(employee)); } finally { ref.release(); } }
From source file:org.parancoe.example.app.UseBookDAO.java
/** * @param args//from w w w . jav a 2 s.c o m */ public static void main(String[] args) { UseBookDAO app = new UseBookDAO(); Book myBook = new Book("Parancoe Team", "Parancoe: the best framework"); Book myBook2 = new Book("Mario Rossi", "My life"); Book myBook3 = new Book("Parancoe Team", "Parancoe: tips & trick"); Book myBook4 = new Book("The Hitchhiker's Guide to the Galaxy", "Douglas Adams", 320); app.bookDao.create(myBook); app.bookDao.create(myBook2); app.bookDao.create(myBook3); app.bookDao.create(myBook4); List<Book> myBooks = app.bookDao.findByAuthor("Parancoe Team"); System.out.println(myBooks.size()); }
From source file:com.sm.store.TestStoreClient.java
public static void main(String[] args) { String[] opts = new String[] { "-store", "-url", "-times" }; String[] defaults = new String[] { "store", "localhost:7100", "10" }; String[] paras = getOpts(args, opts, defaults); String store = paras[0];/*from w ww.ja v a2s . c o m*/ String url = paras[1]; int times = Integer.valueOf(paras[2]); RemotePersistence client = new NTRemoteClientImpl(url, null, store, false); for (int i = 0; i < times; i++) { try { Key key = Key.createKey(i); client.put(key, "times-" + i); Value value = client.get(key); logger.info(value == null ? "null" : value.getData().toString() + " " + value.getVersion()); //value.setVersion( value.getVersion() -1); client.put(key, value); value = client.get(key); logger.info(value == null ? "null" : value.getData().toString() + " " + value.getVersion()); client.put(key, "times-" + i); value = client.get(key); logger.info(value == null ? "null" : value.getData().toString() + " " + value.getVersion()); } catch (Exception ex) { logger.error(ex.getMessage(), ex); } } List<Key> list = client.getKeyList(); logger.info("key size " + list.size()); client.close(); System.exit(0); }
From source file:com.khartec.waltz.jobs.DatabaseHarness.java
public static void main(String[] args) throws ParseException { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(DIConfiguration.class); DatabaseInformationDao databaseDao = ctx.getBean(DatabaseInformationDao.class); DSLContext dsl = ctx.getBean(DSLContext.class); List<DatabaseInformation> dbs = databaseDao.findByApplicationId(801L); System.out.println(dbs.size()); SelectConditionStep<Record1<Long>> idSelector = dsl.select(APPLICATION.ID).from(APPLICATION) .where(APPLICATION.ID.in(801L, 802L, 803L)); Map<Long, List<DatabaseInformation>> moreDbs = databaseDao.findByAppSelector(idSelector); System.out.println(moreDbs.size()); System.out.println(moreDbs.values().size()); }