List of usage examples for java.util List remove
E remove(int index);
From source file:com.alibaba.jstorm.utils.PathUtils.java
public static String parent_path(String path) { List<String> toks = tokenize_path(path); int size = toks.size(); if (size > 0) { toks.remove(size - 1); }// w ww . j ava 2s. com return toks_to_path(toks); }
From source file:com.personal.tools.Collections3.java
/** * a-bList./*from www .ja va2 s . c om*/ */ public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) { List<T> list = new ArrayList<>(a); for (T element : b) { list.remove(element); } return list; }
From source file:com.waku.mmdataextract.ComprehensiveSearch.java
@SuppressWarnings("unchecked") private static boolean searchDone(FileWriter fw, String brandId, int i) { Document resultPage = MyHttpClient.getAsDom4jDoc(SEARCH_ACTION, getMultipartEntity(brandId, i)); List<Element> products = resultPage.selectNodes("//tr[@onmouseout]"); logger.info("Get products count -> " + products.size()); for (Element product : products) { List<Element> items = product.elements(); // Remove last col items.remove(items.size() - 1); Element firstItem = items.get(0); String attributeValue = firstItem.attributeValue("onclick"); String productId = attributeValue.substring(attributeValue.indexOf("('") + 2, attributeValue.indexOf("')")); if (prodIdList.contains(productId)) { logger.info("Get product id duplicated -> " + productId); continue; } else {//from w w w.j a va2 s . co m logger.info("Get product id add -> " + productId); prodIdList.add(productId); StringBuilder sb = new StringBuilder(); // Save image here String toFileName = productId + ".gif"; saveImage(firstItem.element("img").attributeValue("src"), toFileName); sb.append(toFileName + ","); items.remove(0); // remove first one for (Element item : items) { sb.append(item.getText() + ","); } logger.info(sb.toString()); sb.append("\n"); try { fw.write(sb.toString()); } catch (IOException e) { e.printStackTrace(); } } } if (products.size() < 20) return true; else return false; }
From source file:com.mirth.connect.connectors.dimse.DICOMConfigurationUtil.java
public static void configureDcmSnd(MirthDcmSnd dcmsnd, DICOMDispatcher connector, DICOMDispatcherProperties connectorProperties, String[] protocols) throws Exception { if (connectorProperties.getTls() != null && !connectorProperties.getTls().equals("notls")) { if (connectorProperties.getTls().equals("without")) dcmsnd.setTlsWithoutEncyrption(); if (connectorProperties.getTls().equals("3des")) dcmsnd.setTls3DES_EDE_CBC(); if (connectorProperties.getTls().equals("aes")) dcmsnd.setTlsAES_128_CBC();//from w w w . j a v a 2s . c o m if (connectorProperties.getTrustStore() != null && !connectorProperties.getTrustStore().equals("")) dcmsnd.setTrustStoreURL(connectorProperties.getTrustStore()); if (connectorProperties.getTrustStorePW() != null && !connectorProperties.getTrustStorePW().equals("")) dcmsnd.setTrustStorePassword(connectorProperties.getTrustStorePW()); if (connectorProperties.getKeyPW() != null && !connectorProperties.getKeyPW().equals("")) dcmsnd.setKeyPassword(connectorProperties.getKeyPW()); if (connectorProperties.getKeyStore() != null && !connectorProperties.getKeyStore().equals("")) dcmsnd.setKeyStoreURL(connectorProperties.getKeyStore()); if (connectorProperties.getKeyStorePW() != null && !connectorProperties.getKeyStorePW().equals("")) dcmsnd.setKeyStorePassword(connectorProperties.getKeyStorePW()); dcmsnd.setTlsNeedClientAuth(connectorProperties.isNoClientAuth()); protocols = ArrayUtils.clone(protocols); if (connectorProperties.isNossl2()) { if (ArrayUtils.contains(protocols, "SSLv2Hello")) { List<String> protocolsList = new ArrayList<String>(Arrays.asList(protocols)); protocolsList.remove("SSLv2Hello"); protocols = protocolsList.toArray(new String[protocolsList.size()]); } } else if (!ArrayUtils.contains(protocols, "SSLv2Hello")) { List<String> protocolsList = new ArrayList<String>(Arrays.asList(protocols)); protocolsList.add("SSLv2Hello"); protocols = protocolsList.toArray(new String[protocolsList.size()]); } protocols = MirthSSLUtil.getEnabledHttpsProtocols(protocols); dcmsnd.setTlsProtocol(protocols); dcmsnd.initTLS(); } }
From source file:Main.java
/** * add a value to a value list in a Map that has a limited capacity. If the * capacity is exceeded, the oldest entry is discarded. * //from w ww . j a v a 2 s . c o m * @param map * the map. * @param key * the key. * @param value * the value to be added. * @param maxEntries * the capacity of the value list. * @since 0.6 */ public static void addValue(final Map map, final Object key, final Object value, final int maxEntries) { List values; if ((values = (List) map.get(key)) == null) { values = new ArrayList(); } values.add(value); while (values.size() > maxEntries) { values.remove(0); } map.put(key, values); }
From source file:Main.java
private static List<Object> interleave(Collection<? extends Object> collection, String separator) { List<Object> interleaved = new ArrayList<Object>(); for (Object object : collection) { interleaved.add(object);/* w w w .j ava 2s.co m*/ interleaved.add(separator); } if (!interleaved.isEmpty()) { interleaved.remove(interleaved.size() - 1); } return interleaved; }
From source file:Main.java
public static ArrayList<byte[]> cutByteArray(byte[] bs, int bNo) { if (bs.length < 2) { throw new RuntimeException(""); }/*from www . j a v a 2s. c o m*/ List<Byte> list = toList(bs); List<Byte> listHead = new ArrayList<Byte>(); for (int i = 0; i < bNo; i++) { listHead.add(list.get(0)); list.remove(0); } ArrayList<byte[]> arrayList = new ArrayList<byte[]>(); arrayList.add(toBytes(listHead)); arrayList.add(toBytes(list)); return arrayList; }
From source file:apm.common.utils.Collections3.java
/** * a-bList./*from w w w. j a v a 2s. c om*/ */ public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) { List<T> list = new ArrayList<T>(a); for (T element : b) { list.remove(element); } return list; }
From source file:OSGiLocator.java
/** * Removes the given service provider factory from the set of providers for * the service./* w ww .j a va 2 s.c o m*/ * * @param serviceName * The fully qualified name of the service interface. * @param factory * A factory for creating a specific type of service provider. May be * <tt>null</tt> in which case this method does nothing. * @throws IllegalArgumentException * if serviceName is <tt>null</tt> */ public static synchronized void unregister(final String serviceName, final Callable<Class<?>> factory) { if (serviceName == null) { throw new IllegalArgumentException("serviceName cannot be null"); } if (factories != null) { List<Callable<Class<?>>> l = factories.get(serviceName); if (l != null) { l.remove(factory); } } }
From source file:com.epsi.twitterdashboard.utils.JsonFile.java
/** * Delete dashboard bookmark from json file * @param id /*ww w . ja v a 2 s. c o m*/ */ public static void DeleteBookmark(String username, int id) { List<Tweet> bookmarks = ReadBookmarks(username); if (bookmarks == null) { bookmarks.remove(ListFinder.FindTweetById(bookmarks, id)); JSONArray jsonBookmark = new JSONArray(bookmarks); Write(String.format(JsonFile.BookmarkPath, username), jsonBookmark.toString()); } }