}
return -1;
}
+
+ char value;
+
+ public Character( char c ) {
+ value = c;
+ }
+
+ public Character( Character c ) {
+ value = c.value;
+ }
+
+ public String toString() {
+ return ""+value;
+ }
}
-class HashMapIterator {
+class HashMapIterator extends Iterator {
HashMap map;
int type;
int bin;
return o;
} else System.error();
}
+
+ public void remove() {
+ System.out.println( "HashMapIterator.remove() not implemented." );
+ System.exit( -1 );
+ }
}
return size;
}
+ public boolean isEmpty() {
+ return size == 0;
+ }
+
public Object clone() {
System.out.println( "LinkedList.clone() not implemented." );
System.exit(-1);
getLast();
}
- public void removeFirst() {
+ public Object removeFirst() {
if( head == null ) {
System.out.println( "LinkedList: illegal removeFirst()" );
System.exit(-1);
}
+ Object o = head.element;
head = head.next;
if( head != null ) {
head.prev = null;
tail = null;
}
size--;
+ return o;
}
- public void removeLast() {
+ public Object removeLast() {
if( tail == null ) {
System.out.println( "LinkedList: illegal removeLast()" );
System.exit(-1);
}
+ Object o = tail.element;
tail = tail.prev;
if( tail != null ) {
tail.next = null;
head = null;
}
size--;
+ return o;
}
public void remove( Object o ) {
return new String(buffer);
}
+ public String toLowerCase() {
+ char[] buffer=new char[count];
+ for(int i=0; i<count; i++) {
+ char x=charAt(i);
+ if (x>='A'&&x<='Z') {
+ x=(char) ((x-'A')+'a');
+ }
+ buffer[i]=x;
+ }
+ return new String(buffer);
+ }
+
public int indexOf(int ch) {
return this.indexOf(ch, 0);
}
System.printString(a.subString(3));
System.printString(a.subString(3,6));
System.printString("\n");
+
+ String b = "Danger iN cAVErn_coVE";
+ System.out.println( "normal: "+b );
+ System.out.println( "upper: "+b.toUpperCase() );
+ System.out.println( "lower: "+b.toLowerCase() );
}
}