|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
IntegerCache.java | 75% | 80% | 50% | 72.7% |
|
1 | package org.jboss.cache.pojo.collection; | |
2 | ||
3 | /** | |
4 | * Cache of integers in String format from 0-99. | |
5 | */ | |
6 | public class IntegerCache | |
7 | { | |
8 | ||
9 | 0 | private IntegerCache() |
10 | { | |
11 | } | |
12 | ||
13 | private static final String values[] = new String[100]; | |
14 | ||
15 | static | |
16 | { | |
17 | 43 | for (int i = 0; i < values.length; i++) |
18 | 4300 | values[i] = Integer.toString(i).intern(); |
19 | } | |
20 | ||
21 | 7007 | public static String toString(int i) |
22 | { | |
23 | 7007 | if (i >= 0 && i < values.length) |
24 | 7007 | return values[i]; |
25 | 0 | return Integer.toString(i); |
26 | } | |
27 | ||
28 | } |
|