comparison src/org/tmatesoft/hg/internal/Pool2.java @ 304:85b8efde5586

Use memory-friendly set implementation to canonicalize filenames and nodeids
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 21 Sep 2011 18:26:16 +0200
parents 6bb5e7ed051a
children
comparison
equal deleted inserted replaced
303:2ffcbf360fd5 304:85b8efde5586
14 * the terms of a license other than GNU General Public License 14 * the terms of a license other than GNU General Public License
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 org.tmatesoft.hg.util.SparseSet; 19 import org.tmatesoft.hg.util.DirectHashSet;
20
20 21
21 /** 22 /**
22 * 23 *
23 * @author Artem Tikhomirov 24 * @author Artem Tikhomirov
24 * @author TMate Software Ltd. 25 * @author TMate Software Ltd.
25 */ 26 */
26 public class Pool2<T> { 27 public class Pool2<T> {
27 private final SparseSet<T> unify = new SparseSet<T>(); 28 private final DirectHashSet<T> unify = new DirectHashSet<T>();
28 29
29 public Pool2() { 30 public Pool2() {
30 } 31 }
31 32
32 public Pool2(int sizeHint) { 33 public Pool2(int sizeHint) {
55 } 56 }
56 57
57 public int size() { 58 public int size() {
58 return unify.size(); 59 return unify.size();
59 } 60 }
60
61 public void x() {
62 unify.dump();
63 }
64 61
65 @Override 62 @Override
66 public String toString() { 63 public String toString() {
67 StringBuilder sb = new StringBuilder(); 64 StringBuilder sb = new StringBuilder();
68 sb.append(Pool2.class.getSimpleName()); 65 sb.append(Pool2.class.getSimpleName());