Re: Problems with Map.size()..........



gbattine wrote:
It's too low of one unit and i don't understand he cause

Think harder.

int numberOfNumericColumns = (st.countTokens()-1);
^^

/*
* Get the first token from the line. It will be a String
and
its value will be a unique key for the rest of the row.
*/
String key = st.nextToken().trim();

key is never added to the map. So of course there is one element less in the map than columns in the file. Always.

If you re-read my original post, you will find that I sad that there are Map.size() (-1) columns in the map. I wrote that -1 for a reason.

/Thomas
--
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
.



Relevant Pages

  • Re: Oracle Connection Pooling
    ... > public String oracleFormatUrl(String prefix, String host, String port, ... > proprietaryException { ... > * Map from a resource attribute to a proprietary attribute. ... > protected void processCreateRequests ...
    (comp.lang.java.databases)
  • Re: Irregular review procedures for IACR sponsored conferences
    ... There are only three theorems. ... The second says that if you apply the map to an arbitrary but sufficiently ... long string, substrings of the image are uniformly distributed. ... the policy might look pretty dubious. ...
    (sci.crypt)
  • Re: Regarding use of ArrayList as value in Hashtable
    ... say, for example,the value is a String array, with String array then we ... Lists, Integers, and Strings. ... An object splits the stream of characters into tokens of type: MAP, ... enum BContainers{ ...
    (comp.lang.java.programmer)
  • java.lang.NullPointerException..help me!
    ... public UploadedFile getMyFile() { ... // Populate the map from the input file. ... String line = null; ... // Create the array for the numbers which make up the rest of the line. ...
    (comp.lang.java.programmer)
  • Re: AssertionFailure null id in entry
    ... private String MYROW1; ... However, as stated before, when I have a duplicate unique key, it ... EntityMode entityMode) ... Now Hibernate needs to do 2 things - it needs to persist an object to the ...
    (comp.lang.java.programmer)