List of usage examples for java.util ListIterator next
E next();
From source file:de.unisb.cs.st.javaslicer.tracer.instrumentation.PauseTracingInstrumenter.java
@SuppressWarnings("unchecked") public void transform(final ClassNode classNode) { final ListIterator<MethodNode> methodIt = classNode.methods.listIterator(); while (methodIt.hasNext()) { final MethodNode method = methodIt.next(); transformMethod(method, methodIt, Type.getObjectType(classNode.name).getClassName()); }//from w w w .j a v a2s .c om }
From source file:com.bluelotussoftware.apache.commons.fileupload.example.FileUploadServlet.java
/** * Processes requests for both HTTP/*from www .ja va 2s.co m*/ * <code>GET</code> and * <code>POST</code> methods. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */ protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); boolean isMultiPart = ServletFileUpload.isMultipartContent(request); log("isMultipartContent: " + isMultiPart); log("Content-Type: " + request.getContentType()); if (isMultiPart) { // Create a factory for disk-based file items DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(); /* * Set the file size limit in bytes. This should be set as an * initialization parameter */ diskFileItemFactory.setSizeThreshold(1024 * 1024 * 10); //10MB. // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(diskFileItemFactory); // Parse the request List items = null; try { items = upload.parseRequest(request); } catch (FileUploadException ex) { log("Could not parse request", ex); } PrintWriter out = response.getWriter(); out.print("<html><head><title>SUCCESS</title></head><body><h1>DONE!</h1>"); ListIterator li = items.listIterator(); while (li.hasNext()) { FileItem fileItem = (FileItem) li.next(); if (fileItem.isFormField()) { processFormField(fileItem); } else { out.append(processUploadedFile(fileItem)); } } out.print("</body></html>"); out.flush(); out.close(); } }
From source file:com.amazonaws.hbase.connector.HBaseEmitter.java
@Override public List<Map<String, String>> emit(final UnmodifiableBuffer<Map<String, String>> buffer) throws IOException { List<Map<String, String>> records = buffer.getRecords(); ListIterator<Map<String, String>> iterator = records.listIterator(); List<Put> batch = new ArrayList<Put>(); HashMap<String, String> hashMap = (HashMap<String, String>) iterator.next(); while (iterator.hasNext()) { //start with the row key followed by column family batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("user"), Bytes.toBytes("userid"), Bytes.toBytes(hashMap.get("userid")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("user"), Bytes.toBytes("firstname"), Bytes.toBytes(hashMap.get("firstname")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("user"), Bytes.toBytes("lastname"), Bytes.toBytes(hashMap.get("lastname")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("address"), Bytes.toBytes("city"), Bytes.toBytes(hashMap.get("city")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("address"), Bytes.toBytes("state"), Bytes.toBytes(hashMap.get("state")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("contact"), Bytes.toBytes("email"), Bytes.toBytes(hashMap.get("email")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("contact"), Bytes.toBytes("phone"), Bytes.toBytes(hashMap.get("phone")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likesports"), Bytes.toBytes(hashMap.get("likesports")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("liketheatre"), Bytes.toBytes(hashMap.get("liketheatre")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likeconcerts"), Bytes.toBytes(hashMap.get("likeconcerts")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likejazz"), Bytes.toBytes(hashMap.get("likejazz")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likeclassical"), Bytes.toBytes(hashMap.get("likeclassical")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likeopera"), Bytes.toBytes(hashMap.get("likeopera")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likerock"), Bytes.toBytes(hashMap.get("likerock")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likevegas"), Bytes.toBytes(hashMap.get("likevegas")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likebroadway"), Bytes.toBytes(hashMap.get("likebroadway")))); batch.add(new Put(Bytes.toBytes(hashMap.get("username"))).add(Bytes.toBytes("likes"), Bytes.toBytes("likemusicals"), Bytes.toBytes(hashMap.get("likemusicals")))); hashMap = (HashMap<String, String>) iterator.next(); }//from w w w .ja v a 2s . c o m LOG.info("EMIT: " + "records ....." + batch.size()); HBaseUtils.addRecords(hbaseTableName, emrPublicDns, hbaseRestPort, batch); return Collections.emptyList(); //return records; }
From source file:code.lucamarrocco.hoptoad.Backtrace.java
private final List<String> filter(final List<String> backtrace) { final ListIterator<String> iterator = backtrace.listIterator(); while (iterator.hasNext()) { String string = iterator.next(); if (mustBeIgnored(string)) { continue; }/* ww w . j a va 2 s.c om*/ if (not(validBacktrace()).matches(string)) { string = removeDobuleDot(string); } filteredBacktrace.add(string); } return filteredBacktrace; }
From source file:biz.c24.io.spring.integration.config.ValidatingSelectorTests.java
@Test public void testThrowingInvalid() { Employee employee = new Employee(); employee.setSalutation("Mr"); // Invalid as first char not capitalised employee.setFirstName("andy"); employee.setLastName("Acheson"); // Invalid as no job title //employee.setJobTitle("Software Developer"); try {/*from w w w .j a va 2s. c om*/ template.convertAndSend(exceptionThrowingInputChannel, employee); fail("Selector failed to throw exception on invalid message"); } catch (MessageHandlingException ex) { // Expected behaviour assertThat(ex.getCause(), is(C24AggregatedMessageValidationException.class)); C24AggregatedMessageValidationException vEx = (C24AggregatedMessageValidationException) ex.getCause(); ListIterator<ValidationEvent> failures = vEx.getFailEvents(); int failureCount = 0; while (failures.hasNext()) { failureCount++; failures.next(); } assertThat(failureCount, is(2)); } // Make sure there are no other messages floating around assertThat(validChannel.receive(1), is(nullValue())); assertThat(invalidChannel.receive(1), is(nullValue())); }
From source file:gsilva.lirc.lircclient.config.LircConfigReader.java
private void endEntry() { if (program == null || entry.getProgram() == null || !program.equalsIgnoreCase(entry.getProgram())) return;/*from www. j a v a 2 s. com*/ if (validator != null) { ListIterator<String> configs = entry.getConfigs().listIterator(); while (configs.hasNext()) { String config = configs.next(); MutableObject<String> mConfig = new MutableObject<String>(config); String error = validator.validateLircConfig(mConfig); if (error != null) syntaxError(error); configs.set(mConfig.getValue()); } } configEntries.add(entry); }
From source file:com.apigee.sdk.apm.http.impl.client.cache.CacheEntryUpdater.java
private void removeCacheEntry1xxWarnings(List<Header> cacheEntryHeaderList, HttpCacheEntry entry) { ListIterator<Header> cacheEntryHeaderListIter = cacheEntryHeaderList.listIterator(); while (cacheEntryHeaderListIter.hasNext()) { String cacheEntryHeaderName = cacheEntryHeaderListIter.next().getName(); if (HeaderConstants.WARNING.equals(cacheEntryHeaderName)) { for (Header cacheEntryWarning : entry.getHeaders(HeaderConstants.WARNING)) { if (cacheEntryWarning.getValue().startsWith("1")) { cacheEntryHeaderListIter.remove(); }/* w w w . j a v a 2s. com*/ } } } }
From source file:gov.nih.nci.ncicb.cadsr.common.jsp.tag.handler.AltQuestionText.java
private Question getQuestionFromList(String questionIdSeq, List questions) { ListIterator iterate = questions.listIterator(); while (iterate.hasNext()) { Question question = (Question) iterate.next(); if (question.getQuesIdseq().equals(questionIdSeq)) { return question; }//from www.j a v a2s . co m } return null; }
From source file:io.bibleget.VersionsSelect.java
public VersionsSelect() throws ClassNotFoundException { biblegetDB = BibleGetDB.getInstance(); String bibleVersionsStr = biblegetDB.getMetaData("VERSIONS"); JsonReader jsonReader = Json.createReader(new StringReader(bibleVersionsStr)); JsonObject bibleVersionsObj = jsonReader.readObject(); Set<String> versionsabbrev = bibleVersionsObj.keySet(); bibleVersions = new BasicEventList<>(); if (!versionsabbrev.isEmpty()) { for (String s : versionsabbrev) { String versionStr = bibleVersionsObj.getString(s); //store these in an array String[] array;/* ww w. j av a 2s.co m*/ array = versionStr.split("\\|"); bibleVersions.add(new BibleVersion(s, array[0], array[1], StringUtils.capitalize(new Locale(array[2]).getDisplayLanguage()))); } } versionsByLang = new SeparatorList<>(bibleVersions, new VersionComparator(), 1, 1000); int listLength = versionsByLang.size(); enabledFlags = new boolean[listLength]; ListIterator itr = versionsByLang.listIterator(); while (itr.hasNext()) { int idx = itr.nextIndex(); Object next = itr.next(); enabledFlags[idx] = !(next.getClass().getSimpleName().equals("GroupSeparator")); if (enabledFlags[idx]) { versionCount++; } else { versionLangs++; } } this.setModel(new DefaultEventListModel<>(versionsByLang)); this.setCellRenderer(new VersionCellRenderer()); this.setSelectionModel(new DisabledItemSelectionModel()); }
From source file:com.cburch.draw.tools.DrawingAttributeSet.java
public <V> void setValue(Attribute<V> attr, V value) { Iterator<Attribute<?>> ait = attrs.iterator(); ListIterator<Object> vit = values.listIterator(); while (ait.hasNext()) { Object a = ait.next();// ww w . ja v a 2s . co m vit.next(); if (a.equals(attr)) { vit.set(value); AttributeEvent e = new AttributeEvent(this, attr, value); for (AttributeListener listener : listeners) { listener.attributeValueChanged(e); } if (attr == DrawAttr.PAINT_TYPE) { e = new AttributeEvent(this); for (AttributeListener listener : listeners) { listener.attributeListChanged(e); } } return; } } throw new IllegalArgumentException(attr.toString()); }