comparison src/org/tmatesoft/hg/internal/Pool.java @ 196:e2115da4cf6a

Pool objects to avoid memory polution with duplicates
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 18 Apr 2011 18:04:24 +0200
parents c9b305df0b89
children 3dcd3dd90c77
comparison
equal deleted inserted replaced
195:c9b305df0b89 196:e2115da4cf6a
34 unify.put(t, t); 34 unify.put(t, t);
35 rv = t; 35 rv = t;
36 } 36 }
37 return rv; 37 return rv;
38 } 38 }
39
40 @Override
41 public String toString() {
42 StringBuilder sb = new StringBuilder();
43 sb.append(Pool.class.getSimpleName());
44 sb.append('<');
45 if (!unify.isEmpty()) {
46 sb.append(unify.keySet().iterator().next().getClass().getName());
47 }
48 sb.append('>');
49 sb.append(':');
50 sb.append(unify.size());
51 return sb.toString();
52 }
39 } 53 }