Listing 10: LHCF_entry_Demo.java
import java.util.*;
public class LHCF_entry_Demo{
public static void main(String args[]) {
//create a SortedMap -> tree structure
SortedMap SM=new TreeMap();
//create a NavigableMap
NavigableMap NM=(NavigableMap)(SM);
//populate the NM
NM.put(8.09,"Hydro");
NM.put(7.25,"George");
NM.put(9.00,"Any");
NM.put(10.00,"Martin");
NM.put(5.64,"Wallace");
Double test=new Double(9.0);
//lower_entry
Map.Entry<Double,String> lower_entry=NM.lowerEntry(test);
System.out.println("->[Lower_entry "+test+"] -
{"+lower_entry.getKey()+","+lower_entry.getValue()+"} !");
System.out.println("----------------------------------------");
//higher_entry
Map.Entry<Double,String> higher_entry=NM.higherEntry(test);
System.out.println("->[Higher_entry "+test+"] -
{"+higher_entry.getKey()+","+higher_entry.getValue()+"} !");
System.out.println("----------------------------------------");
//ceiling_entry
Map.Entry<Double,String> ceiling_entry=NM.ceilingEntry(test);
System.out.println("->[Ceiling_entry "+test+"] -
{"+ceiling_entry.getKey()+","+ceiling_entry.getValue()+"} !");
System.out.println("----------------------------------------");
//floor_entry
Map.Entry<Double,String> floor_entry=NM.floorEntry(test);
System.out.println("->[Floor_entry "+test+"] -
{"+floor_entry.getKey()+","+floor_entry.getValue()+"} !");
System.out.println("----------------------------------------");
}
}
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.