Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i filtered with the best performance? (JAVA)
    text
    copied!<p>I'm working at a small office,I have an application,it's generate a big text file with 14000 lines;</p> <p>after each generate i must filter it and it's really boring;</p> <p>I wanna write an application with java till I'll can handle it as soon as possible.</p> <p>Please help me; I wrote an application with scanner (Of course with help :) ) but it's not good becase it was very slow;</p> <p>For example it's my file :</p> <pre><code>SET CELL:NAME=CELL:0,CELLID=3; SET LSCID:NAME=LSC:0,NETITYPE=MDCS,T32=5,EACT=FILTER-NOFILTER-MINR-FILTER-NOFILTER,ENSUP=GV2&amp;NCR,MINCELL=6,MSV=PFR,OVLHR=9500,OTHR=80,BVLH=TRUE,CELLID=3,BTLH=TRUE,MSLH=TRUE,EIHO=DISABLED,ENCHO=ENABLED,NARD=NAP_STLP,AMH=ENABLED(3)-ENABLED(6)-ENABLED(9) </code></pre> <p>and I want this output (filter :)</p> <pre><code>CELLID : 3 ENSUP : GV2&amp;NCR ENCHO : ENABLED MSLH : TRUE ------------------------ Count of CELLID : 2 </code></pre> <p>which solution is the best and the fastest than the other ? </p> <p>it's my source code :</p> <pre><code>public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new File("i:\\1\\2.txt")); scanner.useDelimiter(";|,"); Pattern words = Pattern.compile("(CELLID=|ENSUP=|ENCHO=)"); while (scanner.hasNextLine()) { String key = scanner.findInLine(words); while (key != null) { String value = scanner.next(); if (key.equals("CELLID=")) System.out.print("CELLID:" + value+"\n"); //continue with else ifs for other keys else if (key.equals("ENSUP=")) System.out.print("ENSUP:" + value+"\n"); else if (key.equals("ENCHO=")) System.out.print("ENCHO:" + value+"\n"); key = scanner.findInLine(words); } scanner.nextLine(); } } </code></pre> <p>Thank you very much indeed ...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload