List of usage examples for java.util LinkedList LinkedList
public LinkedList()
From source file:EarlyNotify.java
public EarlyNotify() { list = Collections.synchronizedList(new LinkedList()); }
From source file:Main.java
/** * Returns all fields declared in the class passed as argument or in its super classes. *//*from w w w . j ava 2 s .c o m*/ public static List<Field> getAllDeclaredField(Class<?> clazz, boolean includeSuperClass) { final List<Field> result = new LinkedList<Field>(); for (final Field field : clazz.getDeclaredFields()) { result.add(field); } final Class<?> superClass = clazz.getSuperclass(); if (superClass != null && includeSuperClass) { result.addAll(getAllDeclaredField(superClass, true)); } return result; }
From source file:nh.virgo.order.queries.DummyOrders.java
public static List<OrderDto> dummyOrders() { LineItemDto lineItemDto = new LineItemDto("Item-1", 1); LineItemDto lineItemDto2 = new LineItemDto("Item-2", 2); List<LineItemDto> l = new LinkedList<LineItemDto>(); l.add(lineItemDto);//ww w . j ava 2 s . c o m l.add(lineItemDto2); OrderDto order = new OrderDto("Order-1", "customer-1", "email@world.org", "ACTIVE", l); return Lists.newArrayList(order); }
From source file:Utils.java
public static List<Element> findAllElementsByTagName(Element elem, String tagName) { List<Element> ret = new LinkedList<Element>(); findAllElementsByTagName(elem, tagName, ret); return ret;/*w w w. ja v a 2 s . c o m*/ }
From source file:Main.java
/** * Returns a list of the direct {@link Element} children of the given element whose names match * {@code tag}./*from w ww . j av a2s . c o m*/ * * @param parent * The {@link Element} to get the children from. * @param tag * The element name of the children to look for. * @return A {@link LinkedList} of the children {@link Element}s. */ public static LinkedList<Element> getDirectChildren(Element parent, String tag) { LinkedList<Element> list = new LinkedList<>(); for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling()) { if (child instanceof Element && tag.equals(child.getNodeName())) { list.add((Element) child); } } return list; }
From source file:Main.java
/** * /* ww w .j a v a 2 s. co m*/ * <pre> * {@code * map(Arrays.asList("a", "b", "c"), (String content) -> content.length()); * } * </pre> * * @param list * @param function * @return */ public static <T, R> List<R> map(List<T> list, Function<T, R> function) { List<R> mapped = new LinkedList<>(); for (T entry : list) { mapped.add(function.apply(entry)); } return mapped; }
From source file:de.tor.tribes.util.AllyUtils.java
public static Ally[] getAlliesByFilter(final String pFilter, Comparator<Ally> pComparator) { if (pFilter == null) { return new Ally[0]; }//from w w w . ja va2 s . co m final String filter = pFilter.toLowerCase(); List<Ally> allies = new LinkedList<>(); CollectionUtils.addAll(allies, DataHolder.getSingleton().getAllies().values()); if (filter.length() > 0) { CollectionUtils.filter(allies, new Predicate() { @Override public boolean evaluate(Object o) { return pFilter.length() == 0 || ((Ally) o).getName().toLowerCase().contains(filter) || ((Ally) o).getTag().toLowerCase().contains(filter); } }); } if (pComparator != null) { Collections.sort(allies, pComparator); } allies.add(0, NoAlly.getSingleton()); //result = (Ally[]) ArrayUtils.add(result, 0, NoAlly.getSingleton()); return allies.toArray(new Ally[allies.size()]); }
From source file:Utils.java
public static List<Element> findAllElementsByTagNameNS(Element elem, String nameSpaceURI, String localName) { List<Element> ret = new LinkedList<Element>(); findAllElementsByTagNameNS(elem, nameSpaceURI, localName, ret); return ret;/* ww w . j ava 2s . c om*/ }
From source file:com.pddstudio.networkutils.utils.ArpUtils.java
/** * Reads the current ARP list and returns a List of {@link ArpInfo} instances. * @return A list of {@link ArpInfo} instances. *//*ww w . j a v a2 s . co m*/ public static List<ArpInfo> fetchArpList() { List<ArpInfo> arpInfos = new LinkedList<>(); try { List<String> arpList = FileUtils.readLines(new File("/proc/net/arp")); for (String s : arpList) { Log.d("ArpUtils", "Line: " + s); String[] splitted = s.split(" +"); if (splitted[0].equals("IP")) continue; String ip = splitted[0]; String mac = splitted[3]; ArpInfo arpInfo = new ArpInfo(); arpInfo.setIpAddress(ip); arpInfo.setMacAddress(mac); arpInfos.add(arpInfo); } } catch (IOException io) { io.printStackTrace(); } return arpInfos; }
From source file:com.amazonaws.dynamodb.bootstrap.AttributeValueMixInTest.java
/** * A sample scan result with one item to use for tests. *///from w ww .ja va 2 s . c o m public static List<Map<String, AttributeValue>> sampleScanResult() { List<Map<String, AttributeValue>> items = new LinkedList<Map<String, AttributeValue>>(); Map<String, AttributeValue> sampleScanResult = new HashMap<String, AttributeValue>(); sampleScanResult.put("key", new AttributeValue("attribute value")); items.add(sampleScanResult); return items; }