List of usage examples for java.util LinkedList LinkedList
public LinkedList()
From source file:Main.java
public static <T> List<T> makeItemFirst(final List<T> items, T item) { List<T> newItems = new LinkedList<T>(); for (int i = items.indexOf(item); i < items.size(); i++) { newItems.add(items.get(i));// w ww . j av a 2 s . co m } for (int i = items.indexOf(item) - 1; i >= 0; i--) { newItems.add(items.get(i)); } return newItems; }
From source file:com.netsteadfast.greenstep.util.PdfConvertUtils.java
public static List<String> toImageUpload(File pdfFile, int resolution, String system, String uploadType, boolean isFile) throws ServiceException, Exception { List<String> oids = new LinkedList<String>(); List<File> imageFiles = toImageFiles(pdfFile, resolution); for (File file : imageFiles) { oids.add(UploadSupportUtils.create(system, uploadType, isFile, file, file.getName())); }//from w w w.j av a2 s. c o m return oids; }
From source file:be.bittich.dynaorm.core.StringQueryBuilder.java
/** * Return the request to get a row value mapped with the parameters * * @param <T>/*from ww w . j a v a2 s .c om*/ * @param t * @param fieldPrimary * @param dialect * @return * @throws RequestInvalidException */ public static <T> KeyValue<String, List<String>> conditionPrimaryKeysBuilder(T t, Map<Field, PrimaryKey> fieldPrimary, Dialect dialect) throws RequestInvalidException { boolean firstIteration = true; String req = ""; List<String> parameters = new LinkedList(); for (Field field : fieldPrimary.keySet()) { String label = "".equals(fieldPrimary.get(field).label()) ? field.getName() : fieldPrimary.get(field).label(); String value = AnnotationProcessor.getFieldValue(field.getName(), t); if (firstIteration) { req = dialect.where(req); firstIteration = false; } else { req = dialect.andWhere(req); } req = dialect.equalTo(req, label); parameters.add(value); } return new DefaultKeyValue(req, parameters); }
From source file:com.jstar.eclipse.processing.annotations.objects.ImportObject.java
public ImportObject(long startPos, long endPos, String fileName) { this.startPos = startPos; this.endPos = endPos; this.fileName = fileName; specFiles = new LinkedList<String>(); }
From source file:com.clicktravel.cheddar.server.runtime.config.PropertiesConfigurationBuilder.java
public static PropertySourcesPlaceholderConfigurer configurer(final boolean isDevProfileActive, final String servicePropertiesPath) { final String environmentPropertiesPath = "com.clicktravel.services.env.properties"; FeatureRegistry.init(environmentPropertiesPath); final PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer(); configurer.setIgnoreResourceNotFound(true); // Note : Later property resources in this list override earlier ones final List<Resource> resources = new LinkedList<>(); if (isDevProfileActive) { addResource(resources, "local-" + servicePropertiesPath); // TODO Remove when migrated to dev addResource(resources, "dev-" + servicePropertiesPath); } else {//w w w. j av a 2 s. com addResource(resources, servicePropertiesPath); } addResource(resources, "com.clicktravel.cheddar.server.properties"); addResource(resources, environmentPropertiesPath); configurer.setLocations(resources.toArray(new Resource[0])); return configurer; }
From source file:com.textquo.dreamcode.server.JSONHelper.java
public static Map<String, Object> parseJson(String jsonText) { Map<String, Object> json = null; try {// w ww .ja va 2 s.co m org.json.simple.parser.JSONParser parser = new org.json.simple.parser.JSONParser(); ContainerFactory containerFactory = new ContainerFactory() { public List creatArrayContainer() { return new LinkedList(); } public Map createObjectContainer() { return new LinkedHashMap(); } }; json = (Map<String, Object>) parser.parse(jsonText, containerFactory); Iterator iter = json.entrySet().iterator(); LOG.info("==iterate result=="); while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); LOG.info(entry.getKey() + "=>" + entry.getValue()); } LOG.info("==toJSONString()=="); LOG.info(org.json.simple.JSONValue.toJSONString(json)); } catch (ParseException e) { e.printStackTrace(); } return json; }
From source file:Main.java
public static List<org.w3c.dom.Node> getMatchingChildren(org.w3c.dom.Node node, String name) { if (node == null) { return null; }// w ww.j a va2s . com LinkedList<org.w3c.dom.Node> returnList = new LinkedList<org.w3c.dom.Node>(); org.w3c.dom.NodeList childList = node.getChildNodes(); int len = childList.getLength(); for (int i = 0; i < len; i++) { org.w3c.dom.Node curNode = childList.item(i); if (name.equals(curNode.getNodeName())) { returnList.add(curNode); } } return returnList; }
From source file:javaphpmysql.JavaPHPMySQL.java
public static void sendPost() { //Creamos un objeto JSON JSONObject jsonObj = new JSONObject(); //Aadimos el nombre, apellidos y email del usuario jsonObj.put("nombre", nombre); jsonObj.put("apellidos", apellidos); jsonObj.put("email", email); //Creamos una lista para almacenar el JSON List l = new LinkedList(); l.addAll(Arrays.asList(jsonObj)); //Generamos el String JSON String jsonString = JSONValue.toJSONString(l); System.out.println("JSON GENERADO:"); System.out.println(jsonString); System.out.println(""); try {// w ww. j a v a2s .c om //Codificar el json a URL jsonString = URLEncoder.encode(jsonString, "UTF-8"); //Generar la URL String url = SERVER_PATH + "listenPost.php"; //Creamos un nuevo objeto URL con la url donde queremos enviar el JSON URL obj = new URL(url); //Creamos un objeto de conexin HttpURLConnection con = (HttpURLConnection) obj.openConnection(); //Aadimos la cabecera con.setRequestMethod("POST"); con.setRequestProperty("User-Agent", USER_AGENT); con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); //Creamos los parametros para enviar String urlParameters = "json=" + jsonString; // Enviamos los datos por POST con.setDoOutput(true); DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); //Capturamos la respuesta del servidor int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + urlParameters); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } //Mostramos la respuesta del servidor por consola System.out.println(response); //cerramos la conexin in.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static Collection<Node> getChildNodes(Node node) { Collection<Node> list = new LinkedList<Node>(); NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) if (nl.item(i).getNodeType() == Node.ELEMENT_NODE) list.add(nl.item(i));// www . j a va2s .c o m return list; }
From source file:SynchronizedQueue.java
public SynchronizedQueue() { messages = new LinkedList<T>(); }