Simplify array initialization

This commit is contained in:
Trustin Lee 2012-11-10 01:00:26 +09:00
parent d8f0bc9e3e
commit 74a235d29f
6 changed files with 12 additions and 12 deletions

View File

@ -27,7 +27,7 @@ public class QuoteOfTheMomentServerHandler extends SimpleChannelUpstreamHandler
private static final Random random = new Random(); private static final Random random = new Random();
// Quotes from Mohandas K. Gandhi: // Quotes from Mohandas K. Gandhi:
private static final String[] quotes = new String[] { private static final String[] quotes = {
"Where there is love there is life.", "Where there is love there is life.",
"First they ignore you, then they laugh at you, then they fight you, then you win.", "First they ignore you, then they laugh at you, then they fight you, then you win.",
"Be the change you want to see in the world.", "Be the change you want to see in the world.",

View File

@ -31,7 +31,7 @@ import java.io.InputStream;
* </pre> * </pre>
*/ */
public final class SecureChatKeyStore { public final class SecureChatKeyStore {
private static final short[] DATA = new short[] { private static final short[] DATA = {
0xfe, 0xed, 0xfe, 0xed, 0x00, 0x00, 0x00, 0x02, 0xfe, 0xed, 0xfe, 0xed, 0x00, 0x00, 0x00, 0x02,
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
0x00, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x00, 0x07, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c,

View File

@ -15,12 +15,6 @@
*/ */
package org.jboss.netty.handler.codec.http; package org.jboss.netty.handler.codec.http;
import static org.jboss.netty.buffer.ChannelBuffers.*;
import static org.jboss.netty.handler.codec.http.HttpConstants.*;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers; import org.jboss.netty.buffer.ChannelBuffers;
import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.Channel;
@ -30,6 +24,12 @@ import org.jboss.netty.handler.codec.http.HttpHeaders.Values;
import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
import org.jboss.netty.util.CharsetUtil; import org.jboss.netty.util.CharsetUtil;
import java.io.UnsupportedEncodingException;
import java.util.Map;
import static org.jboss.netty.buffer.ChannelBuffers.*;
import static org.jboss.netty.handler.codec.http.HttpConstants.*;
/** /**
* Encodes an {@link HttpMessage} or an {@link HttpChunk} into * Encodes an {@link HttpMessage} or an {@link HttpChunk} into
* a {@link ChannelBuffer}. * a {@link ChannelBuffer}.
@ -46,7 +46,7 @@ import org.jboss.netty.util.CharsetUtil;
*/ */
public abstract class HttpMessageEncoder extends OneToOneEncoder { public abstract class HttpMessageEncoder extends OneToOneEncoder {
private static final byte[] CRLF = new byte[] { CR, LF }; private static final byte[] CRLF = { CR, LF };
private static final ChannelBuffer LAST_CHUNK = private static final ChannelBuffer LAST_CHUNK =
copiedBuffer("0\r\n\r\n", CharsetUtil.US_ASCII); copiedBuffer("0\r\n\r\n", CharsetUtil.US_ASCII);

View File

@ -89,7 +89,7 @@ public class ReadOnlyChannelBufferTest {
expect(buf.getLong(21)).andReturn(22L); expect(buf.getLong(21)).andReturn(22L);
ByteBuffer bb = ByteBuffer.allocate(100); ByteBuffer bb = ByteBuffer.allocate(100);
ByteBuffer[] bbs = new ByteBuffer[] { ByteBuffer.allocate(101), ByteBuffer.allocate(102) }; ByteBuffer[] bbs = { ByteBuffer.allocate(101), ByteBuffer.allocate(102) };
expect(buf.toByteBuffer(23, 24)).andReturn(bb); expect(buf.toByteBuffer(23, 24)).andReturn(bb);
expect(buf.toByteBuffers(25, 26)).andReturn(bbs); expect(buf.toByteBuffers(25, 26)).andReturn(bbs);

View File

@ -37,7 +37,7 @@ public class ProtobufVarint32FrameDecoderTest {
@Test @Test
public void testTinyDecode() { public void testTinyDecode() {
byte[] b = new byte[] { 4, 1, 1, 1, 1 }; byte[] b = { 4, 1, 1, 1, 1 };
embedder.offer(wrappedBuffer(b, 0, 1)); embedder.offer(wrappedBuffer(b, 0, 1));
assertThat(embedder.poll(), is(nullValue())); assertThat(embedder.poll(), is(nullValue()));
embedder.offer(wrappedBuffer(b, 1, 2)); embedder.offer(wrappedBuffer(b, 1, 2));

View File

@ -36,7 +36,7 @@ public class ProtobufVarint32LengthFieldPrependerTest {
@Test @Test
public void testTinyEncode() { public void testTinyEncode() {
byte[] b = new byte[] { 4, 1, 1, 1, 1 }; byte[] b = { 4, 1, 1, 1, 1 };
embedder.offer(wrappedBuffer(b, 1, b.length - 1)); embedder.offer(wrappedBuffer(b, 1, b.length - 1));
assertThat(embedder.poll(), is(wrappedBuffer(b))); assertThat(embedder.poll(), is(wrappedBuffer(b)));
} }