Dobry den
Mam LOG soubor a ten chci analyzovat.

Struktura:
/var/www/xxx/stranka1.html
/var/www/xxx/stranka2.html
/var/www/xxx/stranka1.html
/var/www/xxx/stranka1.html
/var/www/xxx/stranka5.html
...

A ja potrebuji abych ve vysledku zjistil ze:
/var/www/xxx/stranka1.html - 3
/var/www/xxx/stranka2.html - 1
/var/www/xxx/stranka5.html - 1

Zkousel jsem laborovat s TreeSet a Hashtable.
U Hashtable jsem se dostal az do naplneni ale nevim jak jednoduse projit tuto 
strukturu (nejlepe s volbou setrideni podle nazvu souboru (key), nebo poctem 
souboru (value).

Kod na naplneni Hashtable vypada takhle:
        String line = "";
        Hashtable<String, Integer> set = new Hashtable<String, Integer> ();
        
        while ((line = r.readLine()) != null) {
                if (line.trim().compareTo("") == 0) continue;
                if (set.containsKey(line)) {
                        set.put(line, (Integer)set.get(line)+1);
                } else {
                        set.put(line, 1);
                }
        }

Napadla me cesta ze bych si vratil seznam klicu (set.keySet()) ale nejsem si 
jist zda se nedrbu pravou rukou za levym uchem a neresi to samotne trideni.

Dik za rady ci pripadnou pomoc.

BJ

Odpovedet emailem