java.util Package

Dated: 05-21-2001

java.util Package

The java.util classes are listed here.

AbstractCollection (Java 2) AbstractList (2) AbstractMap (2)

AbstractSequentialList (2) AbstractSet (2) ArrayList (2)

Arrays (2) BitSet Calendar

Collections (2) Date Dictionary

EventObject GregorianCalendar HashMap (2)

HashSet (2) HashTable LinkedList (2)

ListResourceBundle Locale Observable

Properties PropertyPermission (2) PropertyResourceBundle

Random ResourceBundle SimpleTimeZone

Stack StringTokenizer TimeZone

TreeMap (2) TreeSet (2) Vector

WeakHashMap (2)

 

java.util defines the following interfaces.

Collection (2) Comparator (2) Enumeration (2)

EventListener Iterator (2) List(2)

ListIterator (2) Map (2) Map.Entry (2)

Observer Set (2) SortedMap (2)

SortedSet (2)

The ResourceBundle, ListResourceBudnle, and PropertyResourceBudnle classes aid in internationalization of large programs with many locale-specific resources. PropertyPermission allows you to grant a read/write permission to a system property.

The Collection Interfaces

Interface

Collection

Enables you to work with groups of objects; it is at the top of the collections hierarchy

List

Extends Collection to handle sequences (list of objects)

Set

Extends Collection to handle sets, which must contain unique elements

SortedSet

Extends Set to handle sorted sets

 

The Collection Interface

Method Summary

Boolean

Add(Object o)
Ensures that this collection contains the specified element (optional operation).

Boolean

AddAll(Collection c)
Adds all of the elements in the specified collection to this collection (optional operation).

Void

Clear()
Removes all of the elements from this collection (optional operation).

Boolean

Contains(Object o)
Returns
true if this collection contains the specified element.

Boolean

ContainsAll(Collection c)
Returns
true if this collection contains all of the elements in the specified collection.

Boolean

Equals(Object o)
Compares the specified object with this collection for equality.

Int

HashCode()
Returns the hash code value for this collection.

Boolean

IsEmpty()
Returns
true if this collection contains no elements.

Iterator

Iterator()
Returns an iterator over the elements in this collection.

Boolean

Remove(Object o)
Removes a single instance of the specified element from this collection, if it is present (optional operation).

Boolean

RemoveAll(Collection c)
Removes all this collection's elements that are also contained in the specified collection (optional operation).

Boolean

RetainAll(Collection c)
Retains only the elements in this collection that are contained in the specified collection (optional operation).

Int

Size()
Returns the number of elements in this collection.

Object[]

ToArray()
Returns an array containing all of the elements in this collection.

Object[]

ToArray(Object[] a)
Returns an array containing all of the elements in this collection whose runtime type is that of the specified array.

(from java.sun.com)

The List Interface

Declares the behavior of a collecxtion that stores a sequence of elements.

Elements accessed by their position in the list, using a zero-based index

May contain duplicate elements.

Method Summary

void

add(int index, Object element)
Inserts the specified element at the specified position in this list (optional operation).

Boolean

add(Object o)
Appends the specified element to the end of this list (optional operation).

Boolean

AddAll(Collection c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

Boolean

addAll(int index, Collection c)
Inserts all of the elements in the specified collection into this list at the specified position (optional operation).

void

clear()
Removes all of the elements from this list (optional operation).

Boolean

contains(Object o)
Returns
true if this list contains the specified element.

Boolean

containsAll(Collection c)
Returns
true if this list contains all of the elements of the specified collection.

Boolean

equals(Object o)
Compares the specified object with this list for equality.

Object

get(int index)
Returns the element at the specified position in this list.

int

hashCode()
Returns the hash code value for this list.

int

indexOf(Object o)
Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.

Boolean

isEmpty()
Returns
true if this list contains no elements.

Iterator

iterator()
Returns an iterator over the elements in this list in proper sequence.

int

lastIndexOf(Object o)
Returns the index in this list of the last occurrence of the specified element, or -1 if this list does not contain this element.

ListIterator

listIterator()
Returns a list iterator of the elements in this list (in proper sequence).

ListIterator

listIterator(int index)
Returns a list iterator of the elements in this list (in proper sequence), starting at the specified position in this list.

Object

remove(int index)
Removes the element at the specified position in this list (optional operation).

Boolean

remove(Object o)
Removes the first occurrence in this list of the specified element (optional operation).

Boolean

removeAll(Collection c)
Removes from this list all the elements that are contained in the specified collection (optional operation).

Boolean

retainAll(Collection c)
Retains only the elements in this list that are contained in the specified collection (optional operation).

Object

set(int index, Object element)
Replaces the element at the specified position in this list with the specified element (optional operation).

int

size()
Returns the number of elements in this list.

List

subList(int fromIndex, int toIndex)
Returns a view of the portion of this list between the specified
fromIndex, inclusive, and toIndex, exclusive.

Object[]

toArray()
Returns an array containing all of the elements in this list in proper sequence.

Object[]

toArray(Object[] a)
Returns an array containing all of the elements in this list in proper sequence; the runtime type of the returned array is that of the specified array.

The Set Interface

Defines a set.

Extends Collection.

Does not allow duplicate elements. The add() method returns false if an attempt is made to add duplicate elements to a set. No additional methods.

 

The SortedSet Interface

Defines the behavior of a set sorted in ascending order.

Method Summary

Comparator

Comparator()
Returns the comparator associated with this sorted set, or
null if it uses its elements' natural ordering.

Object

First()
Returns the first (lowest) element currently in this sorted set.

SortedSet

HeadSet(Object toElement)
Returns a view of the portion of this sorted set whose elements are strictly less than
toElement.

Object

Last()
Returns the last (highest) element currently in this sorted set.

SortedSet

SubSet(Object fromElement, Object toElement)
Returns a view of the portion of this sorted set whose elements range from
fromElement, inclusive, to toElement, exclusive.

SortedSet

TailSet(Object fromElement)
Returns a view of the portion of this sorted set whose elements are greater than or equal to
fromElement.

 

The Collection Classes

Class Description

AbstractCollection Implements most of the Collection interface

AbstractList Extends AbstractCollection and implements most of the List interface

AbstractSequentialList Extends AbstractList for use by a collection that uses

sequential rather than random access of its elements.

LinkedList Implements a linked list by extending AbstractSequentialList.

ArrayList Implements a dynamic array by extending AbstractList.

AbstractSet Extends AbstractCollection and implements most of the Set interface.

HashSet Extends AbsractSet for use with a hash table.

TreeSet Implements a set in a tree. Extends AbstractSet.

 

The ArrayList Class

Can grow as needed.

ArrayList()

ArrayList(Collection c)

ArrayList(int capacity) //initial capacity

Methods

void ensureCapacity (int cap)

void trimToSize()

 

Sample Code

import java.util.*;

class ArrayListDemo {

public static void main (String args[ ]){

ArrayList al = new ArrayList();

System.out.println ("Initial size of al:" + al.size());

al.add("C");

al.add("A");

al.add("E");

al.add("B");

al.add("D");

al.add("F");

al.add(1,"A2");

 

System.out.println ("Size of al after addition:" + al.size());

System.out.println ("Contents of al:" + al);

al.remove("F");

al.remove(2);

System.out.println ("Size of al after deletion:" + al.size());

System.out.println ("Contents of al:" + al);

}

}

Output:

Initial size of al: 0

Size of al after addition: 7

Contents of al: [C, A2, A, E, B, D, F]

Size of al after deletion: 5

Contents of al: [C, A2, E, B, D]

Piece of Code

//Convering an ArrayList to an array

ArrayList ai = new ArrayList();

al.add(new Integer(1));

//….

Object ia[ ] = al.toArray();

The LinkedList Class

LinkedList ()

LinkedList (Collection c)

To add element to the start of the list, use addFirst(); to add to the end, use addLast().

void addFirst()

void addLast()

Object getFirst()

Object getLast()

Object removeFirst()

Object removeLast()

Sample Code

 

import java.util.*;

class LinkedListDemo {

public static void main (String args[ ]){

LinkedList ll = new LinkedList();

ll.add("F");

ll.add("B");

ll.add("D");

ll.add("E");

ll.add("C");

ll.addLast("Z");

ll.addFirst("A");

ll.add(1,"A2");

 

System.out.println ("Original contents of ll:" + ll);

ll.remove("F");

ll.remove(2);

System.out.println ("Contents of ll after deletion:" + ll);

ll.removeFirst();

ll.removeLast();

System.out.println ("Contents of ll after 2nd deletion:" + ll);

Object val = ll.get(2);

ll.set(2, (String) val + Changed");

System.out.println ("Contents of ll after change:" + ll);

}

}

Output:

Original contents of ll: [A, A2, F, B, D, E, C, Z]

Contents of ll after deletion: [A, A2, D, E, C, Z]

Contents of ll after 2nd deletion: [A2, D, E, C]

Contents of ll after change: [A2, D, E Changed, C]

 

The HashSet Class

A hash table stores information by using a mechanism called hashing. Th information content of a key is used to determine a unique value, called its hash code. The hash code is then used as the index at which the data associated with the key is stored.

HashSet ()

HashSet (Collection c)

HashSet (int capacity)

HashSet (int capacity,float fillRatio) // the ratio at which to resize upward(0.0 to 1.0)

 

Sample Code

import java.util.*;

class HashSetDemo {

public static void main (String args[ ]){

HashSet hs = new HashSet();

hs.add("C");

hs.add("A");

hs.add("E");

hs.add("B");

hs.add("D");

hs.add("F");

System.out.println (hs);

}

}

Output:

[C, A, E, B, D, F]

PS: not sorted

The TreeSet Class

Makes an excellent choice when storing large amount of sorted data that must be retrieved quickly.

TreeSet ()

TreeSet (Collection c)

TreeSet (Comparator comp)

TreeSet (SortedSet ss)

Sample Code

import java.util.*;

class TreeSetDemo {

public static void main (String args[ ]){

TreeSet ts = new TreeSet();

ts.add("C");

ts.add("A");

ts.add("E");

ts.add("B");

ts.add("D");

ts.add("F");

System.out.println (ts);

}

}

Output:

[A, B, C, D, E, F]

PS: automatically sorted

 

Accessing a Collection via an Iterator

To cycle through the elements of a Collection.

Iterator enables you to cycle through a collection, obtaining or removing elements. ListIterator extends Iterator to allow bidirectional traversal of a list, and modification of elements.

 

Methods declared by Iterator

Method Summary

Boolean

hasNext()
Returns
true if the iteration has more elements.

Object

next()
Returns the next element in the interation.

Void

remove()
Removes from the underlying collection the last element returned by the iterator (optional operation).

 

Methods declared by ListIterator

Method Summary

Void

add(Object o)
Inserts the specified element into the list (optional operation).

Boolean

hasNext()
Returns
true if this list iterator has more elements when traversing the list in the forward direction.

Boolean

hasPrevious()
Returns
true if this list iterator has more elements when traversing the list in the reverse direction.

Object

next()
Returns the next element in the list.

Int

nextIndex()
Returns the index of the element that would be returned by a subsequent call to
next.

Object

previous()
Returns the previous element in the list.

Int

previousIndex()
Returns the index of the element that would be returned by a subsequent call to
previous.

Void

remove()
Removes from the list the last element that was returned by
next or previous (optional operation).

Void

set(Object o)
Replaces the last element returned by
next or previous with the specified element (optional operation).

 

Using an Iterator

Sample Code

import java.util.*;

class IteratorDemo {

public static void main (String args[ ]){

ArrayList al = new ArrayList();

 

al.add("C");

al.add("A");

al.add("E");

al.add("B");

al.add("D");

al.add("F");

System.out.println ("Original contents of al:");

Iterator itr = al.iterator();

while (itr.hasNext()) {

Object element = itr.next();

System.out.print (element + " ");

}

System.out.println();

ListIterator litr = al.listIterator();

while (itr.hasNext()) {

Object element = itr.next();

litr.set(element + "+");

}

System.out.println ("Modified contents of al:");

itr = al.iterator();

while (itr.hasNext()) {

Object element = itr.next();

System.out.print (element + " ");

}

System.out.println();

 

System.out.println ("Modified list backwards:");

while (litr.hasPrevious()) {

Object element = itr.previous();

System.out.print (element + " ");

}

System.out.println();

}

}

Output:

Original contents of al: C A E B D F

Modified contents of al: C+ A+ E+ B+ D+ F+

Modified list backwards: F+ D+ B+ E+ A+ C+

 

Comparators

Both TreeSet and TreeMap store elements in sorted order. It is the comparator that defines precisely what "sorted order" means. By default, these classes store their elements by using what java refers to as "natural ordering".

The comparator interface defines two methods: compare() and equals()

int compare(Object obj1, Object obj2)

returns 0 if equal, positive if obj1 greater then obj2, else false.

boolean equals(Object obj)

returns if obj and the invoking object are both Comparator objects and use the same ordering.otherwise, false.

Sample Code

import java.util.* ;

class MyComp implements Comparator {

public static void main (String args[ ]) {

public int compare (Object a, Object b) {

String aStr, bStr;

aStr = (String) a;

bStr = (String) b;

return bStr.compareTo(aStr);

}

}

 

 

class CompDemo {

public static void main (String args[ ]){

TreeSet ts = new TreeSet();

ts.add("C");

ts.add("A");

ts.add("E");

ts.add("B");

ts.add("D");

ts.add("F");

Iterator I = ts.iterator();

while (i.hasNext()){

Object element = i.next();

System.out.print (element + " ");

}

System.out.println ();

}

}

Output:

F E D C B A

 

 

The Collection Algorithms

Algorithms are defined as static methods within the Collections class.

Method Summary

Static int

BinarySearch(List list, Object key)
Searches the specified list for the specified object using the binary search algorithm.

static int

BinarySearch(List list, Object key, Comparator c)
Searches the specified list for the specified object using the binary search algorithm.

static void

copy(List dest, List src)
Copies all of the elements from one list into another.

static Enumeration

Enumeration(Collection c)
Returns an enumeration over the specified collection.

static void

fill(List list, Object o)
Replaces all of the elements of the specified list with the specified element.

static Object

max(Collection coll)
Returns the maximum element of the given collection, according to the natural ordering of its elements.

static Object

max(Collection coll, Comparator comp)
Returns the maximum element of the given collection, according to the order induced by the specified comparator.

static Object

min(Collection coll)
Returns the minimum element of the given collection, according to the natural ordering of its elements.

static Object

min(Collection coll, Comparator comp)
Returns the minimum element of the given collection, according to the order induced by the specified comparator.

static List

NCopies(int n, Object o)
Returns an immutable list consisting of
n copies of the specified object.

static void

Reverse(List l)
Reverses the order of the elements in the specified list.

static Comparator

ReverseOrder()
Returns a comparator that imposes the reverse of the natural ordering on a collection of objects that implement the
Comparable interface.

static void

Shuffle(List list)
Randomly permutes the specified list using a default source of randomness.

static void

Shuffle(List list, Random rnd)
Randomly permute the specified list using the specified source of randomness.

static Set

Singleton(Object o)
Returns an immutable set containing only the specified object.

static void

sort(List list)
Sorts the specified list into ascending order, according to the natural ordering of its elements.

static void

sort(List list, Comparator c)
Sorts the specified list according to the order induced by the specified comparator.

static Collection

SynchronizedCollection(Collection c)
Returns a synchronized (thread-safe) collection backed by the specified collection.

static List

SynchronizedList(List list)
Returns a synchronized (thread-safe) list backed by the specified list.

static Map

SynchronizedMap(Map m)
Returns a synchronized (thread-safe) map backed by the specified map.

static Set

SynchronizedSet(Set s)
Returns a synchronized (thread-safe) set backed by the specified set.

static SortedMap

SynchronizedSortedMap(SortedMap m)
Returns a synchronized (thread-safe) sorted map backed by the specified sorted map.

static SortedSet

SynchronizedSortedSet(SortedSet s)
Returns a synchronized (thread-safe) sorted set backed by the specified sorted set.

static Collection

UnmodifiableCollection(Collection c)
Returns an unmodifiable view of the specified collection.

static List

UnmodifiableList(List list)
Returns an unmodifiable view of the specified list.

static Map

UnmodifiableMap(Map m)
Returns an unmodifiable view of the specified map.

static Set

UnmodifiableSet(Set s)
Returns an unmodifiable view of the specified set.

static SortedMap

UnmodifiableSortedMap(SortedMap m)
Returns an unmodifiable view of the specified sorted map.

static SortedSet

UnmodifiableSortedSet(SortedSet s)
Returns an unmodifiable view of the specified sorted set.

 

Arrays

Although not a part of collection framework, Array helps bridge the gap between collections and arrays.

Methods

static List asList(Object [ ] array)

returns a List that is backed by the specified array, ie. Both array and list refer to the same location.

For each of boolean, byte, char, double, float, int, long, short, and Object.

static int binarySearch (array, value)

static boolean equals (array1, array2)

static void fill (array, value)

static void fill (array, start, end, value)

static void sort (array)

static void sort (array, start, end)

The Legacy Classes and Interface

The legacy classes defined by java.util are:

Dictionary

HashTable

Properties

Stack

Vector

There is one legacy interface called Enumeration Interface.

The Enumeration interface defines methods by which you can enumerate(obtain one at a time) the elements in the collection of objects. This legacy has been superceeded by Iterator.

Methods:

boolean hasMoreElements()

Object nextElement()

Vector

Implement dynamic array. Similar to ArrayList, but with two differences. Vector is synchronized, contains many methods that are not part of collection framework.

Vector()

Vector(int size)

Vector(int size, int incr)

Vector(Collection c)

Vector defines these protected data members:

int capacityIncrement;

int elementCount;

Object elementData[ ]

Methods:

Method Summary

Void

add(int index, Object element)
Inserts the specified element at the specified position in this Vector.

Boolean

add(Object o)
Appends the specified element to the end of this Vector.

Boolean

addAll(Collection c)
Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.

Boolean

addAll(int index, Collection c)
Inserts all of the elements in in the specified Collection into this Vector at the specified position.

Void

addElement(Object obj)
Adds the specified component to the end of this vector, increasing its size by one.

Int

capacity()
Returns the current capacity of this vector.

Void

clear()
Removes all of the elements from this Vector.

Object

clone()
Returns a clone of this vector.

Boolean

contains(Object elem)
Tests if the specified object is a component in this vector.

Boolean

containsAll(Collection c)
Returns true if this Vector contains all of the elements in the specified Collection.

Void

copyInto(Object[] anArray)
Copies the components of this vector into the specified array.

Object

elementAt(int index)
Returns the component at the specified index.

Enumeration

elements()
Returns an enumeration of the components of this vector.

Void

ensureCapacity(int minCapacity)
Increases the capacity of this vector, if necessary, to ensure that it can hold at least the number of components specified by the minimum capacity argument.

Boolean

equals(Object o)
Compares the specified Object with this Vector for equality.

Object

firstElement()
Returns the first component (the item at index
0) of this vector.

Object

get(int index)
Returns the element at the specified position in this Vector.

Int

hashCode()
Returns the hash code value for this Vector.

Int

indexOf(Object elem)
Searches for the first occurence of the given argument, testing for equality using the
equals method.

Int

indexOf(Object elem, int index)
Searches for the first occurence of the given argument, beginning the search at
index, and testing for equality using the equals method.

Void

insertElementAt(Object obj, int index)
Inserts the specified object as a component in this vector at the specified
index.

Boolean

isEmpty()
Tests if this vector has no components.

Object

lastElement()
Returns the last component of the vector.

Int

lastIndexOf(Object elem)
Returns the index of the last occurrence of the specified object in this vector.

Int

lastIndexOf(Object elem, int index)
Searches backwards for the specified object, starting from the specified index, and returns an index to it.

Object

remove(int index)
Removes the element at the specified position in this Vector.

Boolean

remove(Object o)
Removes the first occurrence of the specified element in this Vector If the Vector does not contain the element, it is unchanged.

Boolean

removeAll(Collection c)
Removes from this Vector all of its elements that are contained in the specified Collection.

Void

removeAllElements()
Removes all components from this vector and sets its size to zero.

Boolean

removeElement(Object obj)
Removes the first (lowest-indexed) occurrence of the argument from this vector.

Void

removeElementAt(int index)
Deletes the component at the specified index.

Protected void

removeRange(int fromIndex, int toIndex)
Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.

Boolean

retainAll(Collection c)
Retains only the elements in this Vector that are contained in the specified Collection.

Object

set(int index, Object element)
Replaces the element at the specified position in this Vector with the specified element.

Void

setElementAt(Object obj, int index)
Sets the component at the specified
index of this vector to be the specified object.

Void

setSize(int newSize)
Sets the size of this vector.

Int

size()
Returns the number of components in this vector.

List

subList(int fromIndex, int toIndex)
Returns a view of the portion of this List between fromIndex, inclusive, and toIndex, exclusive.

Object[]

toArray()
Returns an array containing all of the elements in this Vector in the correct order.

Object[]

toArray(Object[] a)
Returns an array containing all of the elements in this Vector in the correct order.

String

toString()
Returns a string representation of this Vector, containing the String representation of each element.

Void

trimToSize()
Trims the capacity of this vector to be the vector's current size.

 

Sample Code

import java.util.* ;

class VectorDemo{

public static void main (String args[ ]) {

Vector v = new Vector (3,2);

System.out.println("Initial size:" + v.size());

System.out.println("Initial capacity:" + v.capacity());

v.addElement(new Integer(1));

v.addElement(new Integer(2));

v.addElement(new Integer(3));

v.addElement(new Integer(4));

System.out.println("Capacity after four additions:" + v.capacity());

v.addElement(new Double(5.45));

System.out.println("Current capacity:" + v.capacity());

v.addElement(new Double(6.08));

v.addElement(new Integer(7));

System.out.println("Current capacity:" + v.capacity());

v.addElement(new Float(9.4));

v.addElement(new Integer(10));

System.out.println("Current capacity:" + v.capacity());

v.addElement(new Integer(11));

v.addElement(new Integer(12));

System.out.println("First element:" + (Integer)v.firstElement());

System.out.println("Last element:" + (Integer)v.lastElement());

if (v.contains(new Integer(3)))

System.out.println("Vector contains 3.");

Enumeration e = v.elements();

System.out.println("Elements in vector:");

while (e.hasMoreElements())

System.out.print(e.nextElement()+ " ");

System.out.println();

}

}

Output:

Initial size: 0

Initial capacity: 3

Capacity after four additions: 5

Current capacity: 5

Current capacity: 7

Current capacity: 9

First element: 1

Last element: 12

Vector contains 3.

Elements in vector:

1 2 3 4 5.45 6.08 7 9.4 10 11 12

 

Properties

Is a subclass of Hashtable.

Used to maintain lists of values in which the key is a String and the value is also a String. The Properties class is used in many other Java classes.

Properties defines the following instance variable:

Properties default;

Properties()

Properties(Properties propDefault)

In both cases, the property list is empty.

Methods

Method Summary

String

getProperty(String key)
Searches for the property with the specified key in this property list.

String

getProperty(String key, String defaultValue)
Searches for the property with the specified key in this property list.

void

list(PrintStream out)
Prints this property list out to the specified output stream.

void

list(PrintWriter out)
Prints this property list out to the specified output stream.

void

load(InputStream inStream)
Reads a property list (key and element pairs) from the input stream.

Enumeration

propertyNames()
Returns an enumeration of all the keys in this property list, including the keys in the default property list.

void

save(OutputStream out, String header)
Deprecated. This method does not throw an IOException if an I/O error occurs while saving the property list. As of JDK 1.2, the preferred way to save a properties list is via the
store(OutputStream out, String header) method.

Object

setProperty(String key, String value)
Calls the hashtable method
put.

void

store(OutputStream out, String header)
Writes this property list (key and element pairs) in this
Properties table to the output stream in a format suitable for loading into a Properties table using the load method.

Sample Code

import java.util.*;

class PropDemo{

public static void main (String args[ ]) {

Properties capitals = new Properties ();

Set states;

String str;

capitals.put("Illinois", "Springfield");

capitals.put("Missouri", "Jefferson City");

capitals.put("Washington", "Olympia");

capitals.put("California", "Sacramento");

capitals.put("Indiana", "Indianapolis");

states = capital.keySet();

Iterator itr = states.iterator();

while(itr.hasNext()) {

str = (String) ite.next();

System.out.println("The capital of " + str + " is " + capitals.getProperty (str) + ".");

}

System.out.println();

str = capitals.getProperty("Florida", "Not Found");

System.out.println("The capital of Florida is " + str + " .");

}

}

Output:

The capital of Illinois is Springfield.

The capital of Missouri is Jefferson City.

The capital of Washington is Olympia.

The capital of California is Sacramento.

The capital of Indiana is Indianapolis.

The capital of Florida is Not Found.