Changeset 4d0ccf58f9a7a01af7e35e1068be44965d3f5dc0
- Timestamp:
- 01/02/07 00:40:03
(2 years ago)
- Author:
- Christopher Jung <bktheg@web.de>
- git-committer:
- Christopher Jung <bktheg@web.de> 1167694803 +0100
- git-parent:
[1c1828251075e10595167c20121783f2033a5020]
- git-author:
- Christopher Jung <bktheg@web.de> 1167694803 +0100
- Message:
Zwei Funktionen ergaenzt
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| re8a4b30 |
r4d0ccf5 |
|
| 35 | 35 | import java.util.List; |
|---|
| 36 | 36 | import java.util.Locale; |
|---|
| | 37 | import java.util.Map; |
|---|
| 37 | 38 | import java.util.Properties; |
|---|
| 38 | 39 | import java.util.Set; |
|---|
| … | … | |
| 1175 | 1176 | return result.toString(); |
|---|
| 1176 | 1177 | } |
|---|
| | 1178 | |
|---|
| | 1179 | /** |
|---|
| | 1180 | * Inkrementiert einen Integerwert in einer Map um den Wert 1 |
|---|
| | 1181 | * @param <T> Der Schluesseltyp der Map |
|---|
| | 1182 | * @param map Die Map |
|---|
| | 1183 | * @param property Der Schluessel, dessen Wert inkrementiert werden soll |
|---|
| | 1184 | */ |
|---|
| | 1185 | public static <T> void safeIntInc(Map<T,Integer> map, T property) { |
|---|
| | 1186 | Integer val = map.get(property); |
|---|
| | 1187 | if( val == null ) { |
|---|
| | 1188 | map.put(property, new Integer(0)); |
|---|
| | 1189 | return; |
|---|
| | 1190 | } |
|---|
| | 1191 | |
|---|
| | 1192 | map.put(property, new Integer(val.intValue()+1)); |
|---|
| | 1193 | } |
|---|
| | 1194 | |
|---|
| | 1195 | /** |
|---|
| | 1196 | * Inkrementiert einen Integerwert in einer Map um den Wert 1 |
|---|
| | 1197 | * @param <T> Der Schluesseltyp der Map |
|---|
| | 1198 | * @param map Die Map |
|---|
| | 1199 | * @param property Der Schluessel, dessen Wert inkrementiert werden soll |
|---|
| | 1200 | */ |
|---|
| | 1201 | public static <T> void safeLongInc(Map<T,Long> map, T property) { |
|---|
| | 1202 | Long val = map.get(property); |
|---|
| | 1203 | if( val == null ) { |
|---|
| | 1204 | map.put(property, new Long(0)); |
|---|
| | 1205 | return; |
|---|
| | 1206 | } |
|---|
| | 1207 | |
|---|
| | 1208 | map.put(property, new Long(val.longValue()+1)); |
|---|
| | 1209 | } |
|---|
| 1177 | 1210 | } |
|---|