List of usage examples for java.util ArrayList addAll
public boolean addAll(Collection<? extends E> c)
From source file:it.evilsocket.dsploit.net.http.RequestParser.java
public static ArrayList<BasicClientCookie> getCookiesFromHeaders(ArrayList<String> headers) { ArrayList<String> values = getHeaderValues("Cookie", headers); if (values != null && values.size() > 0) { ArrayList<BasicClientCookie> cookies = new ArrayList<BasicClientCookie>(); for (String value : values) { ArrayList<BasicClientCookie> lineCookies = parseRawCookie(value); if (lineCookies != null && lineCookies.size() > 0) { cookies.addAll(lineCookies); }/*w w w.j ava2s . c o m*/ } // remove google and cloudflare cookies Iterator<BasicClientCookie> it = cookies.iterator(); while (it.hasNext()) { BasicClientCookie cookie = (BasicClientCookie) it.next(); if (cookie.getName().startsWith("__utm") || cookie.getName().equals("__cfduid")) it.remove(); } return cookies.size() > 0 ? cookies : null; } return null; }
From source file:mt.Tracking.java
public static <P extends AbstractFunction2D<P>> ArrayList<Pair<P, ArrayList<PointFunctionMatch>>> findAllFunctions( final ArrayList<Point> mts, final P function, final double maxError, final int minNumInliers, final int maxDist) { boolean fitted; final ArrayList<Point> remainingPoints = new ArrayList<Point>(); if (mts != null) { remainingPoints.addAll(mts); final ArrayList<Pair<P, ArrayList<PointFunctionMatch>>> segments = new ArrayList<Pair<P, ArrayList<PointFunctionMatch>>>(); do {/*from w w w . j a v a 2s .c om*/ fitted = false; final Pair<P, ArrayList<PointFunctionMatch>> f = findFunction(remainingPoints, function.copy(), maxError, minNumInliers, maxDist); if (f != null && f.getB().size() > 0) { fitted = true; segments.add(f); final ArrayList<Point> inlierPoints = new ArrayList<Point>(); for (final PointFunctionMatch p : f.getB()) inlierPoints.add(p.getP1()); remainingPoints.removeAll(inlierPoints); } } while (fitted); return segments; } else return null; }
From source file:com.aniruddhc.acemusic.player.GMusicHelpers.GMusicClientCalls.java
/*************************************************************************************** * <p>/*w w w . jav a 2 s. co m*/ * Queries Google's servers for a list of all songs in the current Google account's * music library. * </p> * * @deprecated The use of this method is highly discouraged as it sends/fetches large * amounts of data from Google's servers. All of this data is readily available via the * Google Play Music app's public ContentProvider. This method uses the WebClient * endpoint. * * @param context The context to use during the download process. * @param continuationToken The token that will return the next set of songs (only 1000 * songs are returned per request). * @return * @throws JSONException ***************************************************************************************/ public static final ArrayList<WebClientSongsSchema> getSongs(Context context, String continuationToken) throws JSONException { JSONForm form = new JSONForm(); form.addField("json", "{\"continuationToken\":\"" + continuationToken + "\"}"); form.close(); String response = mHttpClient.post(context, "https://play.google.com/music/services/loadalltracks?u=0&xt=" + getXtCookieValue(), new ByteArrayEntity(form.toString().getBytes()), form.getContentType()); JSONObject jsonObject = new JSONObject(response); WebClientPlaylistsSchema playlist = new WebClientPlaylistsSchema().fromJsonObject(jsonObject); ArrayList<WebClientSongsSchema> chunkedSongList = new ArrayList<WebClientSongsSchema>(); chunkedSongList.addAll(playlist.getPlaylist()); if (!TextUtils.isEmpty(playlist.getContinuationToken())) { chunkedSongList.addAll(getSongs(context, playlist.getContinuationToken())); } return chunkedSongList; }
From source file:com.yoctopuce.YoctoAPI.YFirmwareUpdate.java
/** * Retruns a list of all the modules in "update" mode. Only USB connected * devices are listed. For modules connected to a YoctoHub, you must * connect yourself to the YoctoHub web interface. * * @return an array of strings containing the serial list of module in "update" mode. *//*from w ww. j a v a 2s .c o m*/ public static ArrayList<String> GetAllBootLoaders() { ArrayList<String> res = new ArrayList<String>(); for (YGenericHub h : YAPI.SafeYAPI()._hubs) { try { ArrayList<String> bootloaders = h.getBootloaders(); if (bootloaders != null) { res.addAll(bootloaders); } } catch (YAPI_Exception e) { YAPI.SafeYAPI()._Log(e.getLocalizedMessage()); } } return res; }
From source file:eionet.cr.harvest.scheduled.HarvestingJob.java
/** * This method should be used classes other than {@link HarvestingJob} itself. It returns list of harvest source currently in * batch queue. The method returns clone of the original queue, to prevent clients from corrupting the original. * * @return List<HarvestSourceDTO>/* w w w. ja va 2s .c o m*/ */ public static List<HarvestSourceDTO> getBatchQueue() { ArrayList<HarvestSourceDTO> clone = new ArrayList<HarvestSourceDTO>(); if (batchQueue != null) { clone.addAll(batchQueue); } return clone; }
From source file:com.clustercontrol.accesscontrol.factory.RoleSelector.java
/** * ???<BR>//from ww w .ja va 2 s. c o m * * @return ?? * @throws HinemosUnknown */ public static ArrayList<SystemPrivilegeInfo> getSystemPrivilegeInfoList() { ArrayList<SystemPrivilegeInfo> list = new ArrayList<SystemPrivilegeInfo>(); List<SystemPrivilegeInfo> systemPrivileges = null; m_log.debug("getting all system privilege..."); // ? systemPrivileges = QueryUtil.getAllSystemPrivilege(); if (systemPrivileges != null && systemPrivileges.size() > 0) { list.addAll(systemPrivileges); } m_log.debug("successful in getting all system privilege."); return list; }
From source file:com.pinterest.secor.util.FileUtil.java
public static String[] listRecursively(String path) throws IOException { ArrayList<String> paths = new ArrayList<String>(); String[] directPaths = list(path); for (String directPath : directPaths) { if (directPath.equals(path)) { assert directPaths.length == 1 : Integer.toString(directPaths.length) + " == 1"; paths.add(directPath);/* w ww. j a v a2s. c o m*/ } else { String[] recursivePaths = listRecursively(directPath); paths.addAll(Arrays.asList(recursivePaths)); } } return paths.toArray(new String[] {}); }
From source file:MultiMap.java
/** Ensure the capcity of the underlying list. * //from w w w . j a v a 2s.c o m */ public static Object ensureSize(Object list, int initialSize) { if (list == null) return new ArrayList(initialSize); if (list instanceof ArrayList) { ArrayList ol = (ArrayList) list; if (ol.size() > initialSize) return ol; ArrayList nl = new ArrayList(initialSize); nl.addAll(ol); return nl; } List l = new ArrayList(initialSize); l.add(list); return l; }
From source file:net.semanticmetadata.lire.utils.FileUtils.java
/** * Returns all images from a directory in an array of File. Image files are identified by their suffix being from {.png, .jpg, .jpeg, .gif}. * * @param directory the directory to start with * @param descendIntoSubDirectories should we include sub directories? * @return an ArrayList<File> containing all the files or nul if none are found.. * @throws IOException/*from w w w . ja v a2 s . c o m*/ */ public static ArrayList<File> getAllImageFiles(File directory, boolean descendIntoSubDirectories) throws IOException { ArrayList<File> resultList = new ArrayList<File>(256); IOFileFilter includeSubdirectories = TrueFileFilter.INSTANCE; if (!descendIntoSubDirectories) includeSubdirectories = null; resultList.addAll(org.apache.commons.io.FileUtils.listFiles(directory, fileFilter, includeSubdirectories)); if (resultList.size() > 0) return resultList; else return null; }
From source file:com.prowidesoftware.swift.model.SwiftMessageUtils.java
/** * Mirrors logic on {@link CurrencyContainer#currencyStrings()} including all fields * @param m//from w ww. j av a2 s .co m * @return an empty list if none found */ public static List<String> currencyStrings(final SwiftMessage m) { if (m != null) { final SwiftBlock4 b4 = m.getBlock4(); if (b4 != null && !b4.isEmpty()) { final ArrayList<String> curs = new ArrayList<String>(); for (final Tag t : b4.getTags()) { final Field f = t.getField(); if (f instanceof CurrencyContainer) { final CurrencyContainer cc = (CurrencyContainer) f; curs.addAll(cc.currencyStrings()); } } return curs; } } return Collections.emptyList(); }