List of usage examples for java.util List iterator
Iterator<E> iterator();
From source file:hivemall.xgboost.XGBoostPredictUDTF.java
@Nonnull private static DMatrix createDMatrix(@Nonnull final List<LabeledPointWithRowId> data) throws XGBoostError { final List<LabeledPoint> points = new ArrayList<>(data.size()); for (LabeledPointWithRowId d : data) { points.add(d.point);//w w w .ja v a 2 s. c om } return new DMatrix(points.iterator(), ""); }
From source file:com.mbeddr.pluginmanager.com.intellij.ide.plugins.RepositoryHelper.java
private static List<IdeaPluginDescriptor> process(@Nullable String repositoryUrl, List<IdeaPluginDescriptor> list) { for (Iterator<IdeaPluginDescriptor> i = list.iterator(); i.hasNext();) { PluginNode node = (PluginNode) i.next(); if (node.getPluginId() == null || repositoryUrl != null && node.getDownloadUrl() == null) { LOG.warn(// w ww .ja v a 2 s.c o m "Malformed plugin record (id:" + node.getPluginId() + " repository:" + repositoryUrl + ")"); i.remove(); continue; } if (repositoryUrl != null) { node.setRepositoryName(repositoryUrl); } if (node.getName() == null) { String url = node.getDownloadUrl(); String name = FileUtil.getNameWithoutExtension(url.substring(url.lastIndexOf('/') + 1)); node.setName(name); } } return list; }
From source file:com.qualogy.qafe.business.integration.adapter.MappingAdapter.java
private static Object adaptToService(DataIdentifier id, In in, AdapterMapping mapping, Object result, ClassLoader externalClassLoader) { if (result == null) result = createServiceObj(mapping.getOutputClass(), externalClassLoader); if (mapping.hasParent()) { result = adaptToService(id, in, mapping.getParent(), result, externalClassLoader); }//from w ww . jav a 2s . c o m List<AdapterAttribute> attributes = mapping.getAdapterAttributes(); if (attributes != null) { for (Iterator<AdapterAttribute> iter = attributes.iterator(); iter.hasNext();) { AdapterAttribute attribute = (AdapterAttribute) iter.next(); Object value = null; String ref = ((in.getRef() == null || StringUtils.isBlank(in.getRef().stringValueOf())) ? "" : (in.getRef().toString() + ".")) + attribute.getName(); if (attribute instanceof AttributeMapping) {//simple attribute or complex attribute with adapter AttributeMapping attrmapping = (AttributeMapping) attribute; if (attrmapping.getAdapter() != null) {//attribute has an adapter value = adaptToService(id, in, attrmapping.getAdapter(), null, externalClassLoader); } else {//simple attribute value = DataStore.findValue(id, ref);//TODO:simple conversion } } else if (attribute instanceof AdapterMapping) {//internal adapter AdapterMapping adaptermapping = (AdapterMapping) attribute; value = adaptToService(id, in, adaptermapping, null, externalClassLoader); } result = adaptToJavaObject(mapping.getId(), attribute.getName(), result, value, externalClassLoader); } } return result; }
From source file:com.tilab.ca.sse.core.util.SSEUtils.java
public static Map sortIntegersMap(Map passedMap) { LOG.debug("[sortHashMapIntegers] - BEGIN"); List mapKeys = new ArrayList(passedMap.keySet()); List mapValues = new ArrayList(passedMap.values()); Collections.sort(mapValues);//w w w . j a va 2 s . com Collections.reverse(mapValues); Collections.sort(mapKeys); Map sortedMap = new LinkedHashMap(); Iterator valueIt = mapValues.iterator(); while (valueIt.hasNext()) { Object val = valueIt.next(); Iterator keyIt = mapKeys.iterator(); while (keyIt.hasNext()) { Object key = keyIt.next(); String comp1 = passedMap.get(key).toString(); String comp2 = val.toString(); if (comp1.equals(comp2)) { passedMap.remove(key); mapKeys.remove(key); sortedMap.put((Integer) key, (Integer) val); break; } } } LOG.debug("[sortHashMapIntegers] - END"); return sortedMap; }
From source file:com.cyclopsgroup.waterview.utils.TypeUtils.java
/** * Return iterator of given object/*from ww w.j a va2s . co m*/ * * @param items Could be any object * @return Iteartor object of it */ public static Iterator iterate(Object items) { if (items instanceof Collection) { return ((Collection) items).iterator(); } else if (items instanceof Iterator) { return (Iterator) items; } else if (items instanceof Enumeration) { return new EnumerationIterator((Enumeration) items); } else if (items instanceof Object[]) { return new ArrayIterator((Object[]) items); } else { List ret = new ArrayList(1); ret.add(items); return ret.iterator(); } }
From source file:de.berlios.jhelpdesk.model.TicketStatus.java
public static String listAsString(List<TicketStatus> inputList) { StringBuilder tsBuf = new StringBuilder(""); if (inputList != null) { for (Iterator<TicketStatus> it = inputList.iterator(); it.hasNext();) { tsBuf.append(it.next().toInt()); if (it.hasNext()) { tsBuf.append(","); }/*from w w w . j a va 2 s. c o m*/ } } return tsBuf.toString(); }
From source file:libepg.common.section.nit.Nit.java
/** * Test of splitByLengthField method, of class ByteArraySplitter. * * @throws org.apache.commons.codec.DecoderException *//*from w ww . j ava 2s .c o m*/ public static void gen() throws DecoderException { final boolean exec = false; if (exec == true) { byte[] src = Hex.decodeHex( "40100004f024411500970100980100990102f1c002f3c002f4c002f5c0430b011727481100e80288600840110004f021411200a10100a20100a30100a9a102fec00300c0430b011727481100e80288600840300004f018410900bf010317c00318c0430b011765841100e80288600840310004f021411200ab0100ac0100ad0100b3a10309c0030ac0430b011765841100e80288600840900004f012410300d301430b011880921100e80288600840910004f015410600c8010320c0430b011880921100e80288600840920004f012410300de01430b011880921100e80288600840d00004f0244115008d01008e01008f010090a102e8c002e9c002eac0430b011957641100e80288600840d10004f024411500b50100b60100b70100bca100bda1030cc0030dc0430b011957641100e80288600840f10004f021411200650100660102bcc002bdc002c3c003a1a4430b011996001100e80288600840f20004f0184109006701006801038ec0430b011996001100e80288600844500004f012410300c001430b011804201100e80288600844510004f012410300c101430b011804201100e80288600844700004f015410600c90100ca01430b011842561100e80288600846710004f012410300ec01430b011842561100e80288600846720004f0124103010001430b011842561100e80288600846b00004f012410300ee01430b011919281100e80288600846b10004f018410900f1010348c00349c0430b011919281100e80288600846b20004f01b410c00e70100e80100e901021302430b011919281100e80288600847300004f012410300ea01430b012072721100e80288600847310004f012410300f201430b012072721100e80288600847320004f012410300f301430b012072721100e80288600847500004f012410300fc01430b012111081100e80288600847510004f012410300f401430b012111081100e80288600847520004f012410300f501430b012111081100e80288600847700004f012410300fb01430b012149441100e80288600847710004f012410300ff01430b012149441100e80288600847720004f0124103010201430b012149441100e802886008" .toCharArray()); int lengthFieldPosition = 5; int lengthFieldLength = 2; List<byte[]> result = ByteArraySplitter.splitByLengthField(src, lengthFieldPosition, lengthFieldLength, (x) -> x & 0x0FFF); Iterator<byte[]> it_result = result.iterator(); StringBuilder s = new StringBuilder(); s.append("\n"); while (it_result.hasNext()) { byte[] res = it_result.next(); s.append("expResult.add(new TransportStreamLoop(Hex.decodeHex(\""); s.append(Hex.encodeHexString(res)); s.append("\".toCharArray())));"); s.append("\n"); } System.out.println(s.toString()); } }
From source file:ca.sfu.federation.utils.IContextUtils.java
public static Map<String, INamed> getElementMap(List<INamed> Elements) { LinkedHashMap<String, INamed> map = new LinkedHashMap<String, INamed>(); Iterator e = Elements.iterator(); while (e.hasNext()) { INamed named = (INamed) e.next(); map.put(named.getName(), named); }//from w ww . j a v a2s. c o m return map; }
From source file:com.liangc.hq.base.utils.MonitorUtils.java
public static List findServerTypes(List servers) { TreeMap serverTypeSet = new TreeMap(); for (Iterator i = servers.iterator(); i.hasNext();) { ServerValue thisAppSvc = (ServerValue) i.next(); if (thisAppSvc != null && thisAppSvc.getServerType() != null) { ServerTypeValue svcType = thisAppSvc.getServerType(); serverTypeSet.put(svcType.getName(), svcType); }/*from ww w .j av a 2 s. co m*/ } return new ArrayList(serverTypeSet.values()); }
From source file:com.aurel.track.persist.TDashboardPanelPeer.java
/** * delete all children and then delete the object * @param objectID//from www. ja v a 2 s .c om * @param con * @throws TorqueException */ public static void deleteChildren(Integer objectID, Connection con) throws TorqueException { //delete also all children LOGGER.debug("Delete children for panel:" + objectID); Criteria critChild = new Criteria(); critChild.add(BaseTDashboardFieldPeer.PARENT, objectID); List fields = BaseTDashboardFieldPeer.doSelect(critChild, con); for (Iterator iterator = fields.iterator(); iterator.hasNext();) { TDashboardField o = (TDashboardField) iterator.next(); Integer dashboardFieldID = o.getObjectID(); //delete the dashboard field params Criteria critparams = new Criteria(); critparams.add(BaseTDashboardParameterPeer.DASHBOARDFIELD, dashboardFieldID); BaseTDashboardParameterPeer.doDelete(critparams, con); //delete the last executed query associated with this dashboard LastExecutedBL.deleteByFilterIDAndFilterType(dashboardFieldID, QUERY_TYPE.DASHBOARD, con); } BaseTDashboardFieldPeer.doDelete(critChild, con); }