List of usage examples for org.apache.commons.collections4 IteratorUtils toList
public static <E> List<E> toList(final Iterator<? extends E> iterator)
From source file:com.github.rvesse.airline.utils.AirlineUtils.java
public static <T> List<T> arrayToList(T[] array) { return IteratorUtils.toList(IteratorUtils.arrayIterator(array)); }
From source file:com.shampan.model.GeneralModel.java
public List<CountriesDAO> getAllCountries() { DBConnection.getInstance().getConnection(); MongoCollection<CountriesDAO> mongoCollection = DBConnection.getInstance().getConnection() .getCollection("countries", CountriesDAO.class); MongoCursor<CountriesDAO> cursorCountryList = mongoCollection.find().iterator(); List<CountriesDAO> countryList = IteratorUtils.toList(cursorCountryList); return countryList; }
From source file:com.bkn.service.EmployeeService.java
public ResponseObject findAll(String userId, int pageNumber) { //Collection<Employee> list = IteratorUtils.toList(empRepo.findByAll(userId).iterator()); PageRequest pageRequest = new PageRequest(pageNumber - 1, PAGE_SIZE); Collection<Employee> list = IteratorUtils.toList(empRepo.findByAll(userId, pageRequest).iterator()); return new ResponseObject(true, "Employee List", new ResponseData(list.size(), list)); }
From source file:com.shampan.model.GeneralModel.java
public List<ReligionsDAO> getAllReligions() { MongoDatabase db = DBConnection.getInstance().getConnection(); MongoCollection<ReligionsDAO> mongoCollection = DBConnection.getInstance().getConnection() .getCollection("religions", ReligionsDAO.class); MongoCursor<ReligionsDAO> CursorReligionList = mongoCollection.find().iterator(); List<ReligionsDAO> religionList = IteratorUtils.toList(CursorReligionList); return religionList; }
From source file:com.bkn.service.EmployeeService.java
public ResponseObject findByName(String name, String userId) { Collection<Employee> list = IteratorUtils.toList(empRepo.findByName(name, userId).iterator()); return new ResponseObject(true, "Employee List By Name", new ResponseData(list.size(), list)); }
From source file:com.github.rvesse.airline.parser.command.SingleCommandParser.java
public T parse(ParserMetadata<T> parserConfig, CommandMetadata commandMetadata, Iterable<GlobalRestriction> restrictions, Iterable<String> args) { if (args == null) throw new NullPointerException("args is null"); ParseState<T> state = tryParse(parserConfig, commandMetadata, args); validate(state, IteratorUtils.toList(restrictions.iterator())); CommandMetadata command = state.getCommand(); //@formatter:off return createInstance(command.getType(), command.getAllOptions(), state.getParsedOptions(), command.getArguments(), state.getParsedArguments(), command.getMetadataInjections(), Collections.<Class<?>, Object>unmodifiableMap( AirlineUtils.singletonMap(CommandMetadata.class, commandMetadata)), state.getParserConfiguration().getCommandFactory()); //@formatter:on }
From source file:com.github.rvesse.airline.Accessor.java
public Accessor(Iterator<Field> path) { this(IteratorUtils.toList(path)); }
From source file:com.github.rvesse.airline.model.ArgumentsMetadata.java
public ArgumentsMetadata(Iterable<String> titles, String description, Iterable<ArgumentsRestriction> restrictions, Iterable<Field> path) { //@formatter:on if (titles == null) throw new NullPointerException("title cannot be null"); if (path == null) throw new NullPointerException("path cannot be null"); if (!path.iterator().hasNext()) throw new IllegalArgumentException("path cannot be empty"); this.titles = ListUtils.unmodifiableList(IteratorUtils.toList(titles.iterator())); this.description = description; this.restrictions = restrictions != null ? AirlineUtils.unmodifiableListCopy(restrictions) : Collections.<ArgumentsRestriction>emptyList(); this.accessors = SetUtils.unmodifiableSet(AirlineUtils.singletonSet(new Accessor(path))); }
From source file:com.github.rvesse.airline.SingleCommand.java
private SingleCommand(Class<C> command, Iterable<GlobalRestriction> restrictions, ParserMetadata<C> parserConfig) { if (command == null) throw new NullPointerException("command is null"); this.parserConfig = parserConfig != null ? parserConfig : MetadataLoader.<C>loadParser(command); this.restrictions = restrictions != null ? IteratorUtils.toList(restrictions.iterator()) : AirlineUtils.arrayToList(GlobalRestriction.DEFAULTS); if (this.restrictions.size() == 0) this.restrictions.addAll(AirlineUtils.arrayToList(GlobalRestriction.DEFAULTS)); commandMetadata = MetadataLoader.loadCommand(command); }
From source file:com.github.rvesse.airline.utils.AirlineUtils.java
public static <T> List<T> listCopy(Iterable<T> iterable) { if (iterable == null) return new ArrayList<T>(); return IteratorUtils.toList(iterable.iterator()); }