Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Navigating the HashMap

Status
Not open for further replies.

bajanmac

Programmer
Nov 12, 2003
3
US
The following code snippet reads a log and returns 1) Values of "35"(type), say a,b,c 2)Values of "39" (ack), say x,,z and 3) ID's for both. I am now trying (unsuccessfully) to produce All id's for, say 35=a and 39=x, then find those id's for 35=a's that do not have corresponding id's for 39=a. I guess I need the Hashmap and hashmap remove functions but i really do not understand - any advice?
FileReader fr = new FileReader("c:xxxx");
BufferedReader br = new BufferedReader(fr);

String sFixmsg = new String();
String sOrderid = new String();
String sTime = new String();
String sType = new String();
String sAck = new String();

while((sFixmsg = br.readLine()) != null)
{
sOrderid=FixReader.ParseFieldsFixmsg, "11");
sTime = FixReader.ParseField(sFixmsg, "52");
sType = FixReader.ParseField(sFixmsg, "35");
sAck = FixReader.ParseField(sFixmsg, "39");
if(sOrderid.length() > 0)
{
System.out.println(sFixmsg);

 
Maybe you can make a class "Order"

class Order {
String sOrderid;
String sTime;
String sType;
String sAck;

public Order(String sOrderId, String sTime, String sType, String sAck) {
String this.sOrderid = sOrderId
String this.sTime = sTime;
String this.sType = sType;
String this.sAck = sAck;
}

}

And add those "Orders" to an array or something. To find all id's that you want, you can just travel the array.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top