java.lang.NoSuchMethodError: method java.util.TreeMap.firstEntry with signature ()Ljava.util.Map$Entry; was not found

StackOverflow https://stackoverflow.com/questions/1750007

  •  20-09-2019
  •  | 
  •  

Question

I'm trying to use ceilingKey(), ceilingEntry(), firstKey() and firstEntry() of the TreeMap class but getting error:
java.lang.NoSuchMethodError: method java.util.TreeMap.firstEntry with signature ()Ljava.util.Map$Entry; was not found.

This error is caused by following code:
if (tmpmap.size() == 1 && tmpmap.firstKey() == req_sbyte && tmpmap.firstEntry().getValue() == req_size) {
send("F" + req_nr + "," + Integer.toString(req_filenr) + "," + Long.toString(req_sbyte) + "," + Integer.toString(req_size), "localhost", CLIENTPORT);
}

This is the output of java -version:
java version "1.5.0" gij (GNU libgcj) version 4.1.2 20070925 (Red Hat 4.1.2-33) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Any explanations why is this happening and how to fix it? I checked libgcj's documentation, and it says there is such method firstEntry() and it returns Entry object which has getValue() method. So I do not clearly understand what is the problem with my code.

Was it helpful?

Solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top