「java重复领取」java uuid 重复
本篇文章给大家谈谈java重复领取,以及java uuid 重复对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
java取List中重复的数据!
package acc.testJSON;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
public class AA {
public static void main(String[] args) {
ListMapInteger,String list=new ArrayListMapInteger,String();
MapInteger,String map2=new HashMapInteger,String();
map2.put(1, "美元");
map2.put(2, "日元");
map2.put(3, "欧元");
map2.put(4, "日元");
map2.put(5, "人民币");
map2.put(10, "欧元");
list.add(map2);
System.out.println("--------之前---------------");
for(int i=0;ilist.size();i++){
MapInteger,String tempMap=list.get(i);
for(EntryInteger,String e:tempMap.entrySet()){
System.out.println("K: "+e.getKey()+" v: "+e.getValue());
}}
System.out.println("---------------------开始处理--------------------------");
ListMapString,Integer newList=new ArrayListMapString,Integer();
AA aa=new AA();
newList=aa.executMoedth(list);//如果有相同的
System.out.println("--------之后---------------");
for(int i=0;inewList.size();i++){
MapString,Integer tempMap=newList.get(i);
for(EntryString,Integer e:tempMap.entrySet()){
System.out.println(e.getValue()+":"+e.getKey());
}}
}
public ListMapString,Integer executMoedth(ListMapInteger,String list){
System.out.println("---------------------处理中--------------------------");
ListMapString,Integer newList=new ArrayListMapString,Integer();
MapString,Integer newMap=new HashMapString,Integer();
for(int i=0;ilist.size();i++){
MapInteger,String tempMap=list.get(i);//第i个list中的Map
for(EntryInteger,String e1:tempMap.entrySet()){//map遍历
int tempi=0;
for(EntryInteger,String e2:tempMap.entrySet()){//map遍历
if(e1.getValue().equals(e2.getValue())){//如果相等
if(!e1.equals(e2))
/* tempi++;
if(tempi=1)*/
{
// newMap.remove(e1.getKey());//移除第一个添加的
int newValus=e1.getKey()+e2.getKey();//得到总钱数
String newKey=e1.getValue();
newMap.remove(e1.getValue());//干掉
newMap.remove(e2.getValue());//干掉
System.out.println("找到一个 已处理:"+newKey + newValus);
newMap.put(newKey,newValus);//新集合
}
//如果新集合里没有的
if(!newMap.containsKey(e1.getValue()))
newMap.put(e1.getValue(),e1.getKey());//新集合
}
}
}
newList.add(newMap);//新集合
}
return newList;
}
}
java代金券只能领一次如何实现
1、首先打开浏览器。
2、其次在浏览器中搜索java官网进入。
3、最后在java官网中输入账号密码点击进入,在java首页领取代金券代金券即可实现。
Java类重复怎么解决
经常用的import com.yy.xx.uu.cc.YourClassName
不经常用的 com.xxx.xxxx.xxxxxx.YourClassName cls =new com.xxx.xxxx.xxxxxx.YourClassName();
在一个包里不能有相同的名字的类,这个是已知的,如果你要相同名字的就用上面的方法,
关于java重复领取和java uuid 重复的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。