One of the commonly asked questions that GeoTools users have is in the use of FeatureCollections and DataStores. This post discusses how to sort a set of features based on attributes. The following code shows how to load a shapefile and the build a Query object to sort the results.
Running this program will produce the following output:
Wyoming: 453588.0
Vermont: 562758.0
District of Columbia: 606900.0
North Dakota: 638800.0
Delaware: 666168.0
South Dakota: 696004.0
Montana: 799065.0
[....]
Illinois: 1.1430602E7
Pennsylvania: 1.1881643E7
Florida: 1.2937926E7
Texas: 1.712202E7
New York: 1.8235907E7
California: 2.9760021E7