How to create a mixed data buffer in Java? -


i need create buffer contains byte , string data. how can in java?

you can use plain array of objects object[] or implementation of collections (list, set) etc.

but why? if want store different types of data in same collection, check design. if still wish create wrapper interface , many want implementations. each implementation store type if data. create collection stores these wrappers:

interface storagecell<t> { }  class stringcell implements storagecell<string>{} class bytecell implements storagecell<byte>{} 

and buffer is: collection<? extends storagecell> buffer = new linkedlist<storagecell>();


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -