Replaces two manual array copies

This is a potential performance boost, but there shouldn't
be too much of a difference.

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
This commit is contained in:
Cruz Julian Bishop 2012-08-09 09:51:43 +10:00
parent e0a88a0f15
commit 618ddb42e3
2 changed files with 3 additions and 6 deletions

View File

@ -15,6 +15,7 @@
*/ */
package org.jboss.netty.handler.codec.http.websocketx; package org.jboss.netty.handler.codec.http.websocketx;
import java.util.Collections;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
@ -112,9 +113,7 @@ public abstract class WebSocketServerHandshaker {
*/ */
public Set<String> getSubprotocols() { public Set<String> getSubprotocols() {
Set<String> ret = new LinkedHashSet<String>(); Set<String> ret = new LinkedHashSet<String>();
for (String p : subprotocols) { Collections.addAll(ret, subprotocols);
ret.add(p);
}
return ret; return ret;
} }

View File

@ -155,9 +155,7 @@ public class CIDR6 extends CIDR {
} else { } else {
// copy the address into a 16 byte array, zero-filled. // copy the address into a 16 byte array, zero-filled.
int p = 16 - b.length; int p = 16 - b.length;
for (int i = 0; i < b.length; i++) { System.arraycopy(b, 0, a, p + 0, b.length);
a[p + i] = b[i];
}
} }
return InetAddress.getByAddress(a); return InetAddress.getByAddress(a);
} }