急求,在线等。

你好你好561 2014-01-02 10:00:21
求高手写个代码。
代码要求:
要求能够随意输入任何数字,然后再删除重复项。
...全文
2019 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
tony4geek 2014-01-08
  • 打赏
  • 举报
回复
小律律 2014-01-08
  • 打赏
  • 举报
回复
引用 4 楼 paddyaiq 的回复:
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = null; System.out.println("Enter your value:"); str = br.readLine(); System.out.println("your value is :"+str); char[] charArray = str.toCharArray(); Set set = new HashSet(); for (int i = 0; i < charArray.length; i++) { set.add(charArray[i]); } Iterator iterator = set.iterator(); while(iterator.hasNext()){ System.out.print(iterator.next()); }
人家给那么详细,怎么不见来结分。。。。。。
别闹腰不好 2014-01-03
  • 打赏
  • 举报
回复
public <T> List<T> getList(List<T> list){ List<T> l=new ArrayList<T>(); for(T v:list){ if(!l.contains(v)){ l.add(v); } } return l; }
ftwinkle 2014-01-02
  • 打赏
  • 举报
回复
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = null; System.out.println("Enter your value:"); str = br.readLine(); System.out.println("your value is :"+str); char[] charArray = str.toCharArray(); Set set = new HashSet(); for (int i = 0; i < charArray.length; i++) { set.add(charArray[i]); } Iterator iterator = set.iterator(); while(iterator.hasNext()){ System.out.print(iterator.next()); }
你好你好561 2014-01-02
  • 打赏
  • 举报
回复
谁能给个详细点的代码 谢谢
huihuisweet 2014-01-02
  • 打赏
  • 举报
回复
TreeSet
末日哥 2014-01-02
  • 打赏
  • 举报
回复
往hashset里面装就行了

50,528

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧