I have a class that has a list of Events.
public class EventScheduler{
List<Event> event
}
public class Event{
private String text;
private int timestamp;
}
I have an EventView, it takes an Event as a constructor and has getters and no setters.
It is basically allows subset of variables set in event to be viewed, whilst acting in a similar fashion to Event.
public class EventView{
public EventView(Event event){
this.event = event;
}
public String getText(){
return event.getText();
}
//no timestamp getter as its not allowed for this view object.
}
So with this setup, what is the quickest way to convert a List<Event> to List<EventView>?
Or some kind of alternative.