On Thursday 02 October 2008 12:30, j16sdiz at freenetproject.org wrote:
> Author: j16sdiz
> Date: 2008-10-02 11:30:51 +0000 (Thu, 02 Oct 2008)
> New Revision: 22908
> 
> Modified:
>    trunk/freenet/src/freenet/support/MultiValueTable.java
> Log:
> Generic for MultiValueTable
> 
> Modified: trunk/freenet/src/freenet/support/MultiValueTable.java
> ===================================================================
> --- trunk/freenet/src/freenet/support/MultiValueTable.java    2008-10-01 
21:59:33 UTC (rev 22907)
> +++ trunk/freenet/src/freenet/support/MultiValueTable.java    2008-10-02 
11:30:51 UTC (rev 22908)
...
>      
> -    public Object[] getArray(Object key) {
> +    public V[] getArray(K key) {
>          synchronized (table) {
> -            Vector v = (Vector) table.get(key);
> +            Vector<V> v = table.get(key);
>              if (v == null)
>                  return null;
>              else {
> -                Object[] r = new Object[v.size()];
> +                V[] r = (V[])new Object[v.size()];

This doesn't work.

bsh % Object[] objects = new Object[5];
bsh % Long[] longs = (Long[]) objects;
// Error: // Uncaught Exception: Typed variable declaration : at Line: 2 : in 
file: <unknown file> : ( Long [ ] ) objects

Target exception: java.lang.ClassCastException: Cannot cast java.lang.Object 
[] to java.lang.Long []

bsh % Long[] longs = (Long[]) objects;


>                  v.copyInto(r);
>                  return r;
>              }
>          }
>      }
>  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20081003/babe03b3/attachment.pgp>

Reply via email to