14
14
15
15
public class GXProperties implements IGxJSONSerializable {
16
16
private LinkedHashMap < String , GXProperty > properties = new LinkedHashMap < > ();
17
- private LinkedHashMap < String , GXProperty > originalProperties = new LinkedHashMap < > ();
18
17
private boolean eof ;
19
18
private int lastElement ;
20
19
@@ -27,9 +26,8 @@ public void set(String name, String value) {
27
26
public void add (String name , String value ) { this .put (name , value ); }
28
27
29
28
public void put (String name , String value ) {
30
- originalProperties .put (name , new GXProperty (name , value ));
31
- name = name .toLowerCase ();
32
- properties .put (name , new GXProperty (name , value ));
29
+ String lowerName = name .toLowerCase ();
30
+ properties .put (lowerName , new GXProperty (name , value ));
33
31
}
34
32
35
33
public String toString () {
@@ -45,7 +43,6 @@ public String get(String name) {
45
43
}
46
44
47
45
public void remove (String name ) {
48
- originalProperties .remove (name );
49
46
name = name .toLowerCase ();
50
47
properties .remove (name );
51
48
}
@@ -57,7 +54,7 @@ public boolean containsKey(String name) {
57
54
58
55
public GXProperty item (int i ) {
59
56
int counter = 0 ;
60
- for (Map .Entry < String , GXProperty > entry : originalProperties .entrySet ()) {
57
+ for (Map .Entry < String , GXProperty > entry : properties .entrySet ()) {
61
58
if (counter ++ == i ) {
62
59
return entry .getValue ();
63
60
}
@@ -75,14 +72,13 @@ public int count() {
75
72
76
73
public void clear () {
77
74
properties .clear ();
78
- originalProperties .clear ();
79
75
}
80
76
81
77
public GXProperty first () {
82
78
eof = false ;
83
79
if (count () > 0 ) {
84
80
lastElement = 0 ;
85
- return originalProperties .entrySet ().iterator ().next ().getValue ();
81
+ return properties .entrySet ().iterator ().next ().getValue ();
86
82
} else {
87
83
eof = true ;
88
84
return null ;
0 commit comments