第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何從員工名單中打印特定月份入職的員工名單?

如何從員工名單中打印特定月份入職的員工名單?

慕姐8265434 2023-09-20 19:12:30
如何從員工名單中打印特定月份入職的員工名單?您好,我正在嘗試打印假設(shè)“六月”加入的員工名單?下面是我的代碼,Pojo 類(lèi):-import java.time.LocalDate;public class Employee {    private String name;    private String empID;    private Designation designation;    private LocalDate dateOfJoining;    private int monthlySalary;    public Employee(String name, String empID, Designation designation, LocalDate dateOfJoining, int monthlySalary) {        super();        this.name = name;        this.empID = empID;        this.designation = designation;        this.dateOfJoining = dateOfJoining;        this.monthlySalary = monthlySalary;    }    public Employee() {    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public String getEmpID() {        return empID;    }    public void setEmpID(String empID) {        this.empID = empID;    }    public Designation getDesignation() {        return designation;    }    public void setDesignation(Designation designation) {        this.designation = designation;    }    public LocalDate getDOJ() {        return dateOfJoining;    }    public void setDOJ(LocalDate dOJ) {        dateOfJoining = dOJ;    }    public int getMonthlySalary() {        return monthlySalary;    }    public void setMonthlySalary(int monthlySalary) {        this.monthlySalary = monthlySalary;    }    @Override    public int hashCode() {        final int prime = 31;        int result = 1;        result = prime * result + ((dateOfJoining == null) ? 0 : dateOfJoining.hashCode());        result = prime * result + ((designation == null) ? 0 : designation.hashCode());        result = prime * result + ((empID == null) ? 0 : empID.hashCode());        result = prime * result + monthlySalary;        result = prime * result + ((name == null) ? 0 : name.hashCode());        return result;    }我為加入詳細(xì)信息的日期創(chuàng)建了一個(gè)單獨(dú)的類(lèi)。
查看完整描述

3 回答

?
元芳怎么了

TA貢獻(xiàn)1798條經(jīng)驗(yàn) 獲得超7個(gè)贊

如果您只想打印 6 月份加入的員工姓名:

listofemployee.stream().filter(employee->employee.getDOJ().getMonth().equals(Month.JUNE)).map(employee.getName()).forEach(System.out::println);


查看完整回答
反對(duì) 回復(fù) 2023-09-20
?
慕尼黑5688855

TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超2個(gè)贊

   for (Employee employee : listofemployee) {

        LocalDate key = employee.getDOJ();

        String value = employee.getName();

        if (key.getMonthValue() == 06) {

            hashmap.put(key, value);

        }

    }

    System.out.println(hashmap);

但這在重復(fù)的情況下不起作用


查看完整回答
反對(duì) 回復(fù) 2023-09-20
?
HUWWW

TA貢獻(xiàn)1874條經(jīng)驗(yàn) 獲得超12個(gè)贊

    for(Employee employee: listofemployee) 

    {

        LocalDate key = employee.getDOJ();

        String value = employee.getName();

        if(key.getMonth() == 6 )

         {

            hashMap.put(key, value); //if the date of joining is same day and time it would replace, as map dont share dups.

          }


     }


查看完整回答
反對(duì) 回復(fù) 2023-09-20
  • 3 回答
  • 0 關(guān)注
  • 162 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)