@@ -45,71 +45,55 @@ public void append(Object val) {
4545
4646 }
4747
48- public void remove (int index ) {
48+ public void remove (int index ) {
4949
50- if (index < 0 ) {
50+ if (index < 0 ) {
5151
52- System .err .println ("List index cannot be negative" );
52+ System .err .println ("List index cannot be negative" );
53+ throw new IndexOutOfBoundsException ();
5354
54- throw new IndexOutOfBoundsException ();
55+ } else if ( index >= this . len ()) {
5556
56- } else if (index > this .len () - 1 ) {
57+ System .err .println ("List index out of range" );
58+ throw new IndexOutOfBoundsException ();
5759
58- System . err . println ( "List index out of range" );
60+ } else {
5961
60- throw new IndexOutOfBoundsException () ;
61-
62- } else {
62+ int i = - 1 ;
63+ int start = - 1 ;
64+ int end = - 1 ;
6365
64- int i = 0 ;
66+ for ( int k = 0 ; k < this . Values . length (); k ++) {
6567
66- for ( int k = 1 ; k < this .Values .length (); k ++ ) {
68+ if ( this .Values .charAt ( k ) == '¢' ) {
6769
68- if ( this . Values . charAt ( k - 1 ) == '¢' ) {
70+ i ++;
6971
7072 if (i == index ) {
7173
72- int j = 0 ;
73-
74- j += k ;
75-
76- while (true ) {
77-
78- if (this .Values .charAt (j ) == '¢' ) {
79-
80- if ( this .Values .charAt (j ) == this .Values .charAt (this .Values .length () - 1 ) ) {
81-
82- this .Values = this .Values .substring (0 , j );
83-
84- } else {
85-
86- this .Values = this .Values .substring (0 , j ) + this .Values .substring (j + 1 );
87-
88- }
74+ start = k ;
8975
90- break ;
76+ } else if ( i == index + 1 ) {
9177
92- } else {
78+ end = k ;
79+ break ;
9380
94- this . Values = this . Values . substring ( 0 , j ) + this . Values . substring ( j + 1 );
81+ }
9582
96- }
83+ }
9784
98- j ++;
85+ }
9986
100- }
87+ if ( end == - 1 ) {
10188
102- this .Index -- ;
89+ end = this .Values . length () ;
10390
104- break ;
91+ }
10592
106- } else {
10793
108- i ++ ;
94+ this . Values = this . Values . substring ( 0 , start ) + this . Values . substring ( end ) ;
10995
110- }
111- }
112- }
96+ this .Index --;
11397 }
11498 }
11599
@@ -164,18 +148,13 @@ public Object get(int index) {
164148 }
165149 }
166150
167- if (result .startsWith ("null" )) {
168-
169- result = result .substring (4 );
170-
171- }
172-
173151 if ("true" .equals (result ) || "false" .equals (result )) {
174152
175153 return Boolean .valueOf (result );
176154 }
177155
178156 try {
157+
179158 return Integer .valueOf (result );
180159
181160 } catch (NumberFormatException e ) {
0 commit comments