List of usage examples for java.util LinkedList LinkedList
public LinkedList()
From source file:com.wavemaker.tools.apidocs.tools.parser.util.Utils.java
public static List<Class<?>> getAllFilteredSuperTypes(Class<?> type) { List<Class<?>> superTypes = new LinkedList<>(); if (type.getSuperclass() != null) { // All classes in java overrides Object, we need to ignore it to avoid making all models as Composed. if (!type.getSuperclass().equals(Object.class)) { if (ContextUtil.getConfiguration().getModelScanner().filter(type.getSuperclass())) { superTypes.add(type.getSuperclass()); }/* w w w.j a va 2s .co m*/ } } return superTypes; }
From source file:com.microsoft.rest.pipeline.HttpResponseInterceptorAdapter.java
/** * Initialize a new instance of HttpResponseInterceptorAdapter. */ public HttpResponseInterceptorAdapter() { filters = new LinkedList<ServiceResponseFilter>(); }
From source file:net.decix.jatlasx.ripe.atlas.api.handler.TraceHandler.java
public List<IpAddress> handleResponse(String jsonString) { List<IpAddress> ipAddresses = new LinkedList<IpAddress>(); JSONArray jsonArray = new JSONArray(jsonString); for (int i = 0; i < 1; i++) { JSONObject hop = (JSONObject) jsonArray.get(i); String ipAddress = "null"; if (hop.has("from")) { ipAddress = String.valueOf(hop.get("from")); }// www. j av a 2 s . c om try { ipAddresses.add(new IpAddress(ipAddress)); } catch (UnknownHostException e) { String errorMsg = "Could not create IP-address:" + ipAddress; System.err.println(e.getClass().getName() + ":" + errorMsg + "(" + this.getClass().getName() + ")"); } } return ipAddresses; }
From source file:com.smallnn.input.FileUtil.java
public static List<File> find(File file, FileFilter filter) { List<File> result = new ArrayList<File>(); LinkedList<File> stack = new LinkedList<File>(); stack.push(file);//from w ww . ja va2 s . c o m while (!stack.isEmpty()) { File f = stack.pop(); if (filter == null || filter.accept(f)) { result.add(f); } if (f.isDirectory() && f.exists()) { stack.addAll(Arrays.asList(f.listFiles())); } } return result; }
From source file:Main.java
/** * Method getChildTags. Get all direct children of given element which * match the given tag./*ww w . j av a 2s. co m*/ * This method only looks at the direct children of the given node, and * doesn't descent deeper into the tree. If a '*' is passed as tag, * all elements are returned. * * @param el Element where to get children from * @param tag Tag to match. Use '*' to match all tags. * @return Collection Collection containing all elements found. If * size() returns 0, then no matching elements * were found. All items in the collection can * be safely cast to type * <code>org.w3c.dom.Element</code>. */ public static Collection<Node> getChildTags(Element el, String tag) { Collection<Node> c; NodeList nl; int len; boolean allChildren; c = new LinkedList<Node>(); nl = el.getChildNodes(); len = nl.getLength(); if ("*".equals(tag)) { allChildren = true; } else { allChildren = false; } for (int i = 0; i < len; i++) { Node n = nl.item(i); if (n instanceof Element) { Element e = (Element) n; if (allChildren || e.getTagName().equals(tag)) { c.add(n); } } } return c; }
From source file:com.offbynull.portmapper.common.RegexUtils.java
/** * Finds all IPv4 addresses in a block of text. * @param text block of text to search in * @return all IPv4 addresses in {@code text} * @throws NullPointerException if any argument is {@code null} *//*from ww w. j av a 2s . co m*/ public static List<String> findAllIpv4Addresses(String text) { Validate.notNull(text); List<String> ret = new LinkedList<>(); Matcher matcher = IPV4_PATTERN.matcher(text); while (matcher.find()) { ret.add(matcher.group(0)); } return ret; }
From source file:com.yahoo.platform.yuitest.coverage.results.DirectoryCoverageReport.java
public DirectoryCoverageReport(String directory) { this.directory = directory; this.fileReports = new LinkedList<FileCoverageReport>(); }
From source file:com.insightml.models.AbstractBasicDoubleLearner.java
private static Pair<double[], double[][]> filter(final LearnerInput<? extends Sample, ? extends Double> input) { final double[][] features = input.getTrain().features(); final Double[] expected = input.getTrain().expected(input.labelIndex); final DoubleArray expFiltered = new DoubleArray(expected.length); final List<double[]> featsFiltered = new LinkedList<>(); for (int i = 0; i < expected.length; ++i) { if (expected[i] != null) { expFiltered.add(expected[i].doubleValue()); featsFiltered.add(features[i]); }/*from w ww . ja va2 s . c o m*/ } final double[][] featsArray = Arrays.of(featsFiltered, double[].class); return new Pair<>(expFiltered.toArray(), featsArray); }
From source file:neo4j.models.log.PerformanceLog.java
public static void create(long duration, LogCategory logCategory, Request<AnyContent> request, String text) { if (Global.isPerformanceLogging() == true) { PerformanceLog result = new PerformanceLog(); result.duration = duration;/* w w w. j a v a 2s . com*/ abstractCreate(result, logCategory, LogLevel.INFO, request, new LinkedList<AbstractModel>()); if (text != null) { result.httpUrl += " - " + text; } Neo4JServiceProvider.get().performanceLogRepository.save(result); } else { String requestString = logCategory.toString(); if (request != null) { requestString += " " + request.uri(); } if (text != null) { requestString += " - " + text; } Logger.info(requestString + " took " + duration + " ms"); } }
From source file:com.erinors.hpb.tests.HpbTestUtils.java
public static void assertEqualsByCloneableFields(Object o1, Object o2) { if (o1 == null || o2 == null || o1.getClass() != o2.getClass()) { throw new IllegalArgumentException( "Non-null objects of same class expected but got: " + o1 + ", " + o2); }/*from ww w .j a v a2s . c om*/ List<Field> fields = new LinkedList<Field>(); ClassUtils.collectCloneableFields(o1.getClass(), fields); for (Field field : fields) { try { ReflectionUtils.makeAccessible(field); Object fieldValue1 = field.get(o1); Object fieldValue2 = field.get(o2); if (!equal(fieldValue1, fieldValue2)) { throw new AssertionError("Field value mismatch: " + field + ", value1=" + fieldValue1 + ", value2=" + fieldValue2); } } catch (Exception e) { throw new RuntimeException("Cannot copy field: " + field, e); } } }