Changeset 2034

Show
Ignore:
Timestamp:
02/17/2010 01:52:42 PM (5 months ago)
Author:
djb61
Message:

Switch usage of Hashtable for the efficient HashMap in the pre plugin, additionally apply some generics and remove some casts.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/plugins/org.drftpd.commands.pre/src/org/drftpd/commands/pre/Pre.java

    r2032 r2034  
    2020import java.io.FileNotFoundException; 
    2121import java.io.IOException; 
    22 import java.util.Hashtable; 
     22import java.util.HashMap; 
    2323import java.util.Map; 
    2424 
     
    107107                 
    108108                //AWARD CREDITS 
    109         Hashtable<User,Long> awards = new Hashtable<User,Long>(); 
     109        HashMap<User,Long> awards = new HashMap<User,Long>(); 
    110110                preAwardCredits(preDir, awards); 
    111111 
    112         for (Object entry : awards.entrySet()) { 
    113             User owner = (User) ((Map.Entry) entry).getKey(); 
     112        for (Map.Entry<User,Long> entry : awards.entrySet()) { 
     113            User owner = entry.getKey(); 
    114114            if (StatsManager.getStatsManager().getCreditCheckRatio(preDir, owner) == 0) { 
    115                 Long award = (Long) ((Map.Entry) entry).getValue(); 
     115                Long award = entry.getValue(); 
    116116                owner.updateCredits(award); 
    117117                response.addComment("Awarded " + Bytes.formatBytes(award) + " to " + owner.getName()); 
     
    167167    } 
    168168 
    169         private void preAwardCredits(DirectoryHandle preDir, Hashtable<User,Long> awards) { 
     169        private void preAwardCredits(DirectoryHandle preDir, HashMap<User,Long> awards) { 
    170170                try { 
    171171                for (InodeHandle file : preDir.getInodeHandlesUnchecked()) {