List of usage examples for java.util ArrayList remove
public boolean remove(Object o)
From source file:filterviewplugin.FilterViewSettings.java
private static ProgramFilter[] getAvailableFilters() { ProgramFilter[] allFilters = Plugin.getPluginManager().getFilterManager().getAvailableFilters().clone(); Arrays.sort(allFilters, new Comparator<ProgramFilter>() { public int compare(ProgramFilter f1, ProgramFilter f2) { return f1.getName().compareToIgnoreCase(f2.getName()); }// ww w . ja v a 2 s . c om }); ArrayList<ProgramFilter> filters = new ArrayList<ProgramFilter>(Arrays.asList(allFilters)); filters.remove(Plugin.getPluginManager().getFilterManager().getAllFilter()); return filters.toArray(new ProgramFilter[filters.size()]); }
From source file:com.cloudmade.api.Utils.java
static Polygon polygonFromJson(JSONArray coords) { ArrayList<Line> lines = linesFromJson(coords); return new Polygon(lines.remove(0), lines.size() > 0 ? lines : null); }
From source file:com.lucidtechnics.blackboard.util.Utility.java
public static ArrayList getAllTypes(ArrayList _searchDomainList, ArrayList _allTypesList) { for (int i = 0; i < _searchDomainList.size(); i++) { Class searchClass = (Class) _searchDomainList.get(i); _searchDomainList.remove(searchClass); Class superClass = searchClass.getSuperclass(); if (superClass != null && (_allTypesList.contains(superClass) == false)) { _searchDomainList.add(superClass); _allTypesList.add(superClass); }//from w ww . j av a 2 s . c o m Class[] interfaceArray = searchClass.getInterfaces(); if (interfaceArray != null) { for (int j = 0; j < interfaceArray.length; j++) { if (interfaceArray[j] != null && (_allTypesList.contains(interfaceArray[j]) == false)) { _searchDomainList.add(interfaceArray[j]); _allTypesList.add(interfaceArray[j]); } } } } if (_searchDomainList.isEmpty() == false) { _allTypesList = getAllTypes(_searchDomainList, _allTypesList); } return _allTypesList; }
From source file:Main.java
public static <T> ArrayList<T> rand(ArrayList<T> population, int nSamplesNeeded) { Random r = new Random(); ArrayList<T> ret = new ArrayList<T>(); if (nSamplesNeeded > population.size() / 2) { ArrayList<T> original = new ArrayList<T>(); original = population;/*from w w w.j a va2s .c o m*/ while (nSamplesNeeded > 0) { int rand = r.nextInt(original.size()); if (rand < nSamplesNeeded) { ret.add(original.get(rand)); original.remove(rand); nSamplesNeeded--; } } original.clear(); } else ret = shuffle(population, nSamplesNeeded); return ret; }
From source file:FileUtils.java
public static String relativePath(String fromPath, String toPath, boolean fromIsDirectory, char separatorChar) { ArrayList<String> fromElements = splitPath(fromPath); ArrayList<String> toElements = splitPath(toPath); while (!fromElements.isEmpty() && !toElements.isEmpty()) { if (!(fromElements.get(0).equals(toElements.get(0)))) { break; }/* w w w .j a va 2 s.co m*/ fromElements.remove(0); toElements.remove(0); } StringBuffer result = new StringBuffer(); for (int i = 0; i < fromElements.size() - (fromIsDirectory ? 0 : 1); i++) { result.append(".."); result.append(separatorChar); } for (String s : toElements) { result.append(s); result.append(separatorChar); } return result.substring(0, result.length() - 1); }
From source file:com.google.cloud.metrics.MetricsUtilsTest.java
/** * Helper method to check that the given value is present in the list, then remove that value * from the list./*from w ww. java 2 s .c o m*/ */ private static void assertContainsAndRemove(ArrayList<String> list, String value) throws Exception { assertThat(list).contains(value); list.remove(value); }
From source file:com.espe.distribuidas.pmaldito.servidorbdd.operaciones.Consultar.java
/** * permite retirar 1 campo de una lista//from w w w .ja v a 2s . c o m * * @param entrada * @param campos * @return */ public static ArrayList<String> retirarCampos(ArrayList<String> entrada, Integer campos) { entrada.remove(campos); return entrada; }
From source file:Main.java
public static void removeStringFromArrayList(String strItem, ArrayList<String> alItems) { // cycles on the arraylist for (int j = 0; j < alItems.size(); j++) { // gets the j-thg item String strValue = alItems.get(j); // if the j-th item is equal to the passed one if (strValue.equals(strItem)) { // removes it alItems.remove(j); // and returns return; }/* w w w.jav a2 s. c o m*/ } }
From source file:com.espe.distribuidas.pmaldito.servidorbdd.operaciones.Consultar.java
/** * permite retirar n campos de una lista * * @param entrada/* w w w . ja v a 2s .co m*/ * @param campos * @return */ public static ArrayList<String> retirarCampos(ArrayList<String> entrada, Integer campos[]) { for (Integer campo : campos) { entrada.remove(campo); } return entrada; }
From source file:models.Watch.java
public static List<String> findWatchedResourceIds(User user, ResourceType resourceType) { ArrayList<String> resourceIds = new ArrayList<>(); for (Watch watch : Watch.findBy(user, resourceType)) { resourceIds.add(watch.resourceId); }//from w ww. j a v a 2 s.c o m for (Unwatch unwatch : Unwatch.findBy(user, resourceType)) { resourceIds.remove(unwatch.resourceId); } return resourceIds; }