I have to create a result list by adding objects from one array list to another. Here is my code that works.
    private List<MyObject> getObjectList(List<OtherObject> objects) {
        List<MyObject> resultList = new ArrayList<>();
        for (int i = 0; i < objects.size(); i++) {
        MyObject object = new MyObject()
            object.setId(objects.get(i).getId());
            object.setText(objects.get(i).getTextValue());
            object.setUserId(objects.get(i).getUserName());
            object.setCreatedDate(objects.get(i).getCreateDateTime());
            resultList.add(object);
        }
        
        return resultList;
    }
How can I achieve this by using lambda expression?
 
     
     
     
    