remove null rows from 2D array

Discussion in 'Java' started by doha786, Apr 7, 2010.

  1. doha786

    doha786 New Member

    Joined:
    Apr 7, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    hi,
    the method of my program return rows with some values... now i need to use condition of values to show. in this case its returning conditional values including null rows.

    how can i remove null rows from arrays ?
    Code:
    public String[][] process(String searchName, String value){
    ..
    String[][] row=null;
    
    Map<String, File> names = new HashMap<String, File>();
    
    try{  
    ..
    ...
    
     row = new String[names.keySet().size()][];
    int i = 0;
     for (String found: names.keySet()) {
    ..
    ..
    [B]if(file.length()>1024){[/B]
    row[i] =new String[]{found, file.getName(), Long.toString(file.length())};
    i++;
    
    
    
    }
    }
    catch(Exception e) {e.printStackTrace() }
     
    return row;
    please help to figure out this....
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice