KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In some code I'm creating a List of Bytes, and want to insert an array of bytes into the list as I am building it. What is the cleanest way of doing this? See code below - thanks. public class ListInsert { public static byte[] getData() { return new byte[]{0x01, 0x02, 0x03}; } public static void main(String[] args) { final List<Byte> list = new ArrayList<Byte>(); list.add((byte)0xaa); list.add(getData()); // I want to insert an array of bytes into the list here list.add((byte)0x55); } }
Tags (comma-separated)
Save Edits
Cancel