Changeset b97ad6c5


Ignore:
Timestamp:
Dec 22, 2010 10:23:34 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
12fae66
Parents:
97f0c13
Message:

generics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/bencode/BEncoder.java

    r97f0c13 rb97ad6c5  
    6060      bencode((List)o, out);
    6161    else if (o instanceof Map)
    62       bencode((Map)o, out);
     62      bencode((Map<String, Object>)o, out);
    6363    else if (o instanceof BEValue)
    6464      bencode(((BEValue)o).getValue(), out);
     
    154154  }
    155155
    156   public static byte[] bencode(Map m)
     156  public static byte[] bencode(Map<String, Object> m)
    157157  {
    158158    try
     
    168168  }
    169169
    170   public static void bencode(Map m, OutputStream out) throws IOException
     170  public static void bencode(Map<String, Object> m, OutputStream out) throws IOException
    171171  {
    172172    out.write('d');
    173173
    174174    // Keys must be sorted. XXX - But is this the correct order?
    175     Set s = m.keySet();
    176     List l = new ArrayList(s);
     175    Set<String> s = m.keySet();
     176    List<String> l = new ArrayList(s);
    177177    Collections.sort(l);
    178178
    179     Iterator it = l.iterator();
     179    Iterator<String> it = l.iterator();
    180180    while(it.hasNext())
    181181      {
    182182        // Keys must be Strings.
    183         String key = (String)it.next();
     183        String key = it.next();
    184184        Object value = m.get(key);
    185185        bencode(key, out);
Note: See TracChangeset for help on using the changeset viewer.