开发者

Interface declaration to handle primitive types

开发者 https://www.devze.com 2023-02-16 08:04 出处:网络
I have an interface that declares set() method. One implementing class operates on byte[] arrays, therefore it will implement set(byte[] arr)

I have an interface that declares set() method.

One implementing class operates on byte[] arrays, therefore it will implement set(byte[] arr) Another class operates on int[] arrays, therefore it will implement set(int [] arr).

Since int & byte are primitive types, I'm 开发者_开发技巧not sure how to write the interface declaration!

Any ideas? Thanks.


interface Name<T> {
  void set(T object);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消