/[projects]/dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/DeduplicateHelper.java
ViewVC logotype

Contents of /dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/DeduplicateHelper.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2327 - (show annotations) (download)
Thu Feb 19 10:36:40 2015 UTC (9 years, 3 months ago) by torben
File size: 430 byte(s)
Tilføj deduplicatehelper for at begrænse hukommelses forbruget

1 package dk.daoas.fulddaekning;
2
3 import java.util.HashMap;
4
5 /* Kopieret fra dk.daoas.daoadresseservice */
6
7 public class DeduplicateHelper<T> {
8 private HashMap<T,T> cache = new HashMap<T,T>();
9
10 public T getInstance(T newT) {
11 if (newT == null) {
12 return null;
13 }
14
15 T cachedT = cache.get(newT);
16 if ( cachedT == null ) {
17 cachedT = newT;
18 cache.put(newT, newT);
19 }
20 return cachedT;
21 }
22
23 }

  ViewVC Help
Powered by ViewVC 1.1.20