zoukankan      html  css  js  c++  java
  • 惨叫

    今天没学东西,被会长的代码蹂躏,所以就发个他的代码吧

    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.Map.Entry;
    
    public class KaoQing {
        public static void validate(String all,String part)
        {
            String[]alls=all.split("
    ");
            String[]parts=part.split("
    ");
            Map<String,Integer> map=new HashMap<String,Integer>();
            for(int i=0;i<alls.length;i++)
                map.put(alls[i], 0);
            for(int i=0;i<parts.length;i++)
                if(map.containsKey(parts[i]))
                    map.put(parts[i], 1);
            int count=0;
            for(Entry<String,Integer>e:map.entrySet())
                if(e.getValue()==0)
                {
                    System.out.println(e.getKey());
                    count++;
                }
            System.out.println("总计"+count);
        }
        public static String readFromTxt(String filename) throws IOException
        {
            BufferedReader br=new BufferedReader(new FileReader(filename));
            String result="";
            String s="";
            while((s=br.readLine())!=null)
                result+=s+"
    ";
            br.close();
            return result;
        }
        public static void main(String[] args) throws IOException {
            validate(readFromTxt("D:\考勤总名单.txt"),readFromTxt("D:\签到名单.txt"));
        }
    
    }
  • 相关阅读:
    大道至简阅读笔记01
    3.2-3.8 第三周总结
    全国疫情统计可视化地图 01
    数据爬取
    全国疫情统计可视化地图
    第3周总结
    第2周总结
    开课博客
    数组
    从小工到专家 读后感2
  • 原文地址:https://www.cnblogs.com/LYY1084702511/p/10836094.html
Copyright © 2011-2022 走看看