comparison src/org/tmatesoft/hg/internal/IntMap.java @ 656:a937e63b6e02

Performance: rebuild information about branches takes too long (my improvement: 3 times, 11-15 s to less than 4 sec)
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 04 Jul 2013 18:40:03 +0200
parents f41dd9a3b8af
children d2552e6a5af6
comparison
equal deleted inserted replaced
655:bcbcc318f250 656:a937e63b6e02
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.internal; 17 package org.tmatesoft.hg.internal;
18 18
19 import java.util.Arrays; 19 import java.util.Arrays;
20 import java.util.Collection;
20 import java.util.Iterator; 21 import java.util.Iterator;
21 import java.util.Map; 22 import java.util.Map;
22 import java.util.Map.Entry; 23 import java.util.Map.Entry;
23 import java.util.NoSuchElementException; 24 import java.util.NoSuchElementException;
24 25
214 Map.Entry<Integer, V> next = it.next(); 215 Map.Entry<Integer, V> next = it.next();
215 map.put(next.getKey(), next.getValue()); 216 map.put(next.getKey(), next.getValue());
216 } 217 }
217 return map; 218 return map;
218 } 219 }
220
221 public Collection<V> values() {
222 @SuppressWarnings("unchecked")
223 V[] rv = (V[]) new Object[size];
224 System.arraycopy(values, 0, rv, 0, size);
225 return Arrays.<V>asList(rv);
226 }
219 227
220 // copy of Arrays.binarySearch, with upper search limit as argument 228 // copy of Arrays.binarySearch, with upper search limit as argument
221 private static int binarySearch(int[] a, int high, int key) { 229 private static int binarySearch(int[] a, int high, int key) {
222 int low = 0; 230 int low = 0;
223 high--; 231 high--;