@Test(expected = IllegalArgumentException.class) public void testRejectsEmptyLists() { new ListLexicoder<>(new LongLexicoder()).encode(emptyList()); }
@Override public byte[] encode(List<LT> v) { if (v.isEmpty()) { throw new IllegalArgumentException("ListLexicoder does not support empty lists"); } byte[][] encElements = new byte[v.size()][]; int index = 0; for (LT element : v) { encElements[index++] = escape(lexicoder.encode(element)); } return concat(encElements); }
ListLexicoder extends AbstractLexicoder<List<LT>> { @Override public byte[] encode(List<LT> v) { if (v.isEmpty()) { throw new IllegalArgumentException("ListLexicoder does not support empty lists"); } byte[][] encElements = new byte[v.size()][]; int index = 0; for (LT element : v) { encElements[index++] = escape(lexicoder.encode(element)); } return concat(encElements); } }
ListLexicoder extends AbstractLexicoder<List<LT>> { @Override public byte[] encode(List<LT> v) { if (v.isEmpty()) { throw new IllegalArgumentException("ListLexicoder does not support empty lists"); } byte[][] encElements = new byte[v.size()][]; int index = 0; for (LT element : v) { encElements[index++] = escape(lexicoder.encode(element)); } return concat(encElements); } ListLexicoder(Lexicoder<LT> lexicoder); }
ListLexicoder extends AbstractLexicoder<List<LT>> { @Override public byte[] encode(List<LT> v) { if (v.isEmpty()) { throw new IllegalArgumentException("ListLexicoder does not support empty lists"); } byte[][] encElements = new byte[v.size()][]; int index = 0; for (LT element : v) { encElements[index++] = escape(lexicoder.encode(element)); } return concat(encElements); } ListLexicoder(Lexicoder<LT> lexicoder); @Override byte[] encode(List<LT> v); @Override List<LT> decode(byte[] b); }
ListLexicoder extends AbstractLexicoder<List<LT>> { @Override public byte[] encode(List<LT> v) { if (v.isEmpty()) { throw new IllegalArgumentException("ListLexicoder does not support empty lists"); } byte[][] encElements = new byte[v.size()][]; int index = 0; for (LT element : v) { encElements[index++] = escape(lexicoder.encode(element)); } return concat(encElements); } ListLexicoder(Lexicoder<LT> lexicoder); @Override byte[] encode(List<LT> v); @Override List<LT> decode(byte[] b);  }