List of usage examples for java.util HashMap size
int size
To view the source code for java.util HashMap size.
Click Source Link
From source file:io.lightlink.excel.ExcelImportExportTest.java
private void compareAssertMap(String position, HashMap<String, Object> data, Map<String, Object> loadedData) { assertEquals("Sizez must be equal", data.size(), loadedData.size()); for (Map.Entry<String, Object> entry : data.entrySet()) { Object expected = entry.getValue(); Object found = loadedData.get(entry.getKey()); compareAssertObject(position + "." + entry.getKey(), expected, found); }/*w w w . j a v a 2s . c o m*/ }
From source file:org.kitodo.data.elasticsearch.index.type.BatchTypeTest.java
@Test public void shouldCreateDocuments() { BatchType batchType = new BatchType(); List<Batch> batches = prepareData(); HashMap<Integer, HttpEntity> documents = batchType.createDocuments(batches); assertEquals("HashMap of documents doesn't contain given amount of elements!", 3, documents.size()); }
From source file:br.unicamp.ic.recod.gpsi.ml.gpsi1NNToMomentScalarClassificationAlgorithm.java
@Override public void fit(HashMap<Byte, ArrayList<double[]>> x) { int i;/*from www.j a va 2 s. c om*/ double[] centroid; RealMatrix entities; this.centroids = new HashMap<>(); this.nClasses = x.size(); this.dimensionality = 0; for (byte label : x.keySet()) { if (this.dimensionality <= 0) this.dimensionality = x.get(label).get(0).length; entities = MatrixUtils.createRealMatrix(x.get(label).toArray(new double[0][])); centroid = new double[this.dimensionality]; for (i = 0; i < this.dimensionality; i++) centroid[i] = this.moment.evaluate(entities.getColumn(i)); this.centroids.put(label, centroid); } }
From source file:org.kitodo.data.elasticsearch.index.type.HistoryTypeTest.java
@Test public void shouldCreateDocuments() { HistoryType historyType = new HistoryType(); List<History> histories = prepareData(); HashMap<Integer, HttpEntity> documents = historyType.createDocuments(histories); assertEquals("HashMap of documents doesn't contain given amount of elements!", 2, documents.size()); }
From source file:org.kitodo.data.index.elasticsearch.type.HistoryTypeTest.java
@Test public void shouldCreateDocuments() throws Exception { HistoryType historyType = new HistoryType(); List<History> histories = prepareData(); HashMap<Integer, HttpEntity> documents = historyType.createDocuments(histories); assertEquals("HashMap of documents doesn't contain given amount of elements!", 2, documents.size()); }
From source file:org.kitodo.data.elasticsearch.index.type.WorkpieceTypeTest.java
@Test public void shouldCreateDocuments() { WorkpieceType workpieceType = new WorkpieceType(); List<Workpiece> workpieces = prepareData(); HashMap<Integer, HttpEntity> documents = workpieceType.createDocuments(workpieces); assertEquals("HashMap of documents doesn't contain given amount of elements!", 2, documents.size()); }
From source file:org.kitodo.data.elasticsearch.index.type.TemplateTypeTest.java
@Test public void shouldCreateDocuments() { TemplateType processType = new TemplateType(); List<Template> processes = prepareData(); HashMap<Integer, HttpEntity> documents = processType.createDocuments(processes); assertEquals("HashMap of documents doesn't contain given amount of elements!", 2, documents.size()); }
From source file:kmi.taa.core.SmallSetAnalyser.java
public double std(HashMap<Integer, Double> map) { double[] va = new double[map.size()]; int i = 0;/*from www. j av a 2s . co m*/ for (Integer k : map.keySet()) { va[i++] = map.get(k).doubleValue(); } DescriptiveStatistics ds = new DescriptiveStatistics(va); return ds.getStandardDeviation(); }
From source file:org.kitodo.data.elasticsearch.index.type.PropertyTypeTest.java
@Test public void shouldCreateDocuments() { PropertyType propertyType = new PropertyType(); List<Property> properties = prepareData(); HashMap<Integer, HttpEntity> documents = propertyType.createDocuments(properties); assertEquals("HashMap of documents doesn't contain given amount of elements!", 2, documents.size()); }
From source file:indexer.DocClusterer.java
public List<CentroidCluster<WordVec>> clusterWords(HashMap<String, WordVec> wvecMap, int numClusters) throws Exception { System.out.println("Clustering document: " + dvec.getDocId()); List<WordVec> wordList = new ArrayList<>(wvecMap.size()); for (Map.Entry<String, WordVec> e : wvecMap.entrySet()) { wordList.add(e.getValue());/*from www . j a v a2 s. c o m*/ } KMeansPlusPlusClusterer<WordVec> clusterer = new KMeansPlusPlusClusterer<>( Math.min(numClusters, wordList.size())); if (wordList.size() == 0) return null; List<CentroidCluster<WordVec>> clusters = clusterer.cluster(wordList); return clusters; }