List of usage examples for java.util ArrayList addAll
public boolean addAll(Collection<? extends E> c)
From source file:com.caju.uheer.app.services.infrastructure.ContactablesLoaderCallbacks.java
@Override public void onLoadFinished(Loader<Cursor> arg0, Cursor cursor) { final ArrayList<String> infoAndName = new ArrayList<String>(); try {/*from w w w. j a v a 2 s . c o m*/ for (int i = 0; i < usersFound.length(); i++) { infoAndName.add(usersFound.getJSONObject(i).getString("name")); } } catch (JSONException e) { e.printStackTrace(); } LocationManager locationManager = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); LocationListener locationListener = new LocationListener() { @Override public void onLocationChanged(Location location) { Location geoPointLocation = new Location("geoPoint"); try { infoAndName.clear(); for (int i = 0; i < usersFound.length(); i++) { String appendedText = ""; if (!usersFound.getJSONObject(i).has("channel")) { geoPointLocation.setLongitude(usersFound.getJSONObject(i).getDouble("lon")); geoPointLocation.setLatitude(usersFound.getJSONObject(i).getDouble("lat")); float distance = location.distanceTo(geoPointLocation) / 1000; appendedText = String.format("%.1f", distance) + "Km"; } else { appendedText = usersFound.getJSONObject(i).getString("channel"); } infoAndName.add(appendedText + usersFound.getJSONObject(i).getString("name")); Log.e("infoandname", infoAndName.toString() + infoAndName.get(0) + infoAndName.get(1)); Toast.makeText(mContext, infoAndName.toString() + infoAndName.get(0) + infoAndName.get(1), Toast.LENGTH_LONG).show(); // infoAndName tem a informacao de distancia ou canal e o nome. Precisa editar //essa parte de baixo pra usar o infoAndName. ArrayList<String> friendsEmails = new ArrayList<>(); friendsEmails.addAll(infoAndName); friendsEmails = new ArrayList<>(); for (ArrayList<String> array : ServerInformation.getAllActiveListeners()) { friendsEmails.addAll(array); while (friendsEmails.contains(connectedEmail)) friendsEmails.remove(connectedEmail); } EmailListAdapter listAdapter = new EmailListAdapter(mContext, R.layout.adapter_email_list, friendsEmails); ListView emails = (ListView) ((Activity) mContext) .findViewById(R.id.gps_friends_from_drawer); emails.setAdapter(listAdapter); } } catch (JSONException e) { e.printStackTrace(); } } @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } }; // Minimum of 2 minutes between checks (120000 milisecs). locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 120000, 0, locationListener); }
From source file:com.thoughtworks.gauge.refactor.JavaRefactoring.java
private List<JavaParseWorker> parseJavaFiles(File workingDir, String fileName) { ArrayList<JavaParseWorker> javaFiles = new ArrayList<>(); File[] allFiles = workingDir.listFiles(); for (File file : allFiles) { if (file.isDirectory()) { javaFiles.addAll(parseJavaFiles(file, fileName)); } else {/* w w w . j a va 2 s . c o m*/ if (file.getAbsolutePath().endsWith(fileName)) { JavaParseWorker worker = new JavaParseWorker(file); worker.start(); javaFiles.add(worker); } } } return javaFiles; }
From source file:edu.ucdenver.ccp.nlp.ae.dict_util.GeneInfoToDictionary.java
public GeneInfoToDictionary(File geneFile) throws IOException { filterSingleLetterTerms = true;//from w ww. j a va 2s . c om namespacesToInclude = null; BufferedReader reader = null; try { // Create synonyms hash from 5th and 14th columns. They have duplicates, so create // a back hash so you can see how many id's share a particular other designation. // 5th col. is synonyms. 14th is Other Designations //reader = FileReaderUtil.initBufferedReader(geneFile, CharacterEncoding.UTF_8); CharsetDecoder csd = Charset.forName("UTF-8").newDecoder().onMalformedInput(CodingErrorAction.REPORT) .onUnmappableCharacter(CodingErrorAction.REPORT); InputStream ins = new FileInputStream(geneFile); reader = new BufferedReader(new InputStreamReader(ins, csd)); reader.readLine(); while (reader.ready()) { String line = reader.readLine(); String[] parts = line.split("\t"); String id = parts[1]; String[] synonyms = parts[4].split("\\|"); String[] other = parts[13].split("\\|"); ArrayList<String> allSynonyms = new ArrayList<String>(); if (!parts[4].equals("-")) { allSynonyms.addAll(Arrays.asList(synonyms)); } if (!parts[13].equals("-")) { allSynonyms.addAll(Arrays.asList(other)); } for (String syn : allSynonyms) { if (idToSynonymMap.get(id) == null) { idToSynonymMap.put(id, new ArrayList<String>()); } idToSynonymMap.get(id).add(syn); if (synonymToIdMap.get(syn) == null) { synonymToIdMap.put(syn, new ArrayList<String>()); } synonymToIdMap.get(syn).add(id); } } } finally { try { reader.close(); } catch (Exception x) { } } }
From source file:com.tesora.dve.sql.util.PEDDL.java
@Override public List<String> getCreateStatements() throws Exception { ArrayList<String> buf = new ArrayList<String>(); if (!tenant) { for (StorageGroupDDL sgddl : persGroups) { buf.addAll(sgddl.getCreateStatements()); }// w w w. java2 s . c o m buf.addAll(templateDeclarations); for (DatabaseDDL dbddl : getDatabases()) { buf.addAll(dbddl.getCreateStatements()); } setCreated(); } buf.add("use " + getDatabases().get(0).getDatabaseName()); return buf; }
From source file:graph.module.OntologyEdgeModule.java
private ArrayList<Object> recurseIndexed(Node[] nodes, String prefix) { ArrayList<Object> args = new ArrayList<>(nodes.length * 2); for (int i = 0; i < nodes.length; i++) { if (nodes[i] instanceof Edge) { args.addAll(recurseIndexed(((Edge) nodes[i]).getNodes(), prefix + (i + 1) + FUNC_SPLIT)); } else {//from w w w .j a v a 2 s. c o m args.add(nodes[i]); args.add((prefix + (i + 1)).intern()); } } return args; }
From source file:osh.busdriver.mielegateway.MieleGatewayDispatcher.java
/** * Collect all information about Miele devices and provide it * (to MieleGatewayDriver)//from w w w . jav a 2 s .co m * * @return */ public Collection<MieleDeviceHomeBusData> getDeviceData() { ArrayList<MieleDeviceHomeBusData> devices = new ArrayList<MieleDeviceHomeBusData>(); synchronized (this) { devices.addAll(deviceData.values()); } return devices; }
From source file:com.thoughtworks.webanalyticsautomation.Engine.java
private ArrayList<String> getAllTagsFromExpectedSectionList(ArrayList<Section> expectedSectionList) { ArrayList<String> allTags = new ArrayList<String>(); allTags.add("Following tags found missing: "); for (Section expectedSection : expectedSectionList) { allTags.addAll(expectedSection.getLoadedTagList()); }/*from w ww .j a v a 2s.c o m*/ return allTags; }
From source file:edu.cornell.mannlib.vitro.webapp.controller.edit.listing.DataPropertyHierarchyListingController.java
private void addChildren(DataProperty parent, ArrayList list, int position, String ontologyUri) { if (parent == null) { return;//w w w . j a v a2s . c om } list.addAll(addDataPropertyDataToResultsList(parent, position, ontologyUri)); List childURIstrs = dpDao.getSubPropertyURIs(parent.getURI()); if ((childURIstrs.size() > 0) && position < MAXDEPTH) { List childProps = new ArrayList(); Iterator childURIstrIt = childURIstrs.iterator(); while (childURIstrIt.hasNext()) { String URIstr = (String) childURIstrIt.next(); DataProperty child = (DataProperty) dpDao.getDataPropertyByURI(URIstr); childProps.add(child); } Collections.sort(childProps); Iterator childPropIt = childProps.iterator(); while (childPropIt.hasNext()) { DataProperty child = (DataProperty) childPropIt.next(); addChildren(child, list, position + 1, ontologyUri); } } }
From source file:io.cloudslang.engine.node.services.WorkerNodeServiceImpl.java
@Override @Transactional(readOnly = true)/*from w w w. ja v a 2s. co m*/ public List<String> readWorkerGroups(String uuid) { WorkerNode node = readByUUID(uuid); ArrayList<String> res = new ArrayList<>(); res.addAll(node.getGroups()); return res; }
From source file:ca.blackperl.WordFilterStreamBuilder.java
public void main() { // create the twitter search listener PhraseListener listener = new PhraseListener(args); // Connect to twitter. final TwitterStream twitterStream = new TwitterStreamFactory().getInstance(); // The listener to the twitter connection twitterStream.addListener(listener); // Build a search configuration ArrayList<Long> follow = new ArrayList<Long>(); ArrayList<String> track = new ArrayList<String>(); for (String arg : args) { if (isNumericalArgument(arg)) { for (String id : arg.split(",")) { follow.add(Long.parseLong(id)); }//from ww w . ja v a 2 s . c om } else { track.addAll(Arrays.asList(arg.split(","))); } } long[] followArray = new long[follow.size()]; for (int i = 0; i < follow.size(); i++) { followArray[i] = follow.get(i); } String[] trackArray = track.toArray(new String[track.size()]); // filter() method internally creates a thread which manipulates // TwitterStream and calls the listener methods continuously. // pass the search configuration to the twitter library to start the search twitterStream.filter(new FilterQuery(0, followArray, trackArray)); // Create a timer final Timer timer = new Timer(); // Create a task to run every minute, starting in one minute. TimerTask summaryTask = new SummaryTask(listener, timer, twitterStream); timer.schedule(summaryTask, TimeToRunInSeconds * 1000, TimeToRunInSeconds * 1000); }