1. Convert Set into List in Java 1 liner :
Convert Set to array and convert array to list
Set Ids = new HashSet();
Arrays.asList(Ids.toArray())
Enum Class :
public enum DeviceStates {
SHIPPED ("SHIPPED", 1),
INSTALLED_NOT_REPORTING("INSTALLED_NOT_REPORTING", 2),
NWKDESIGNED_NOT_REPORTING("NWKDESIGNED_NOT_REPORTING", 3),
NOT_INSTALLED_REPORTING("NOT_INSTALLED_REPORTING", 4),
NOT_DESIGNED_REPORTING("NOT_DESIGNED_REPORTING", 5),
REPORTING("REPORTING", 6),
RMA("RMA", 7),
SCRAPPED("SCRAPPED", 8);
private long deviceStateId;
private String deviceStateName;
public long getDeviceStateId() {
return deviceStateId;
}
DeviceStates(String deviceStateName, long deviceStateId) {
this.deviceStateId = deviceStateId;
this.deviceStateName = deviceStateName;
}
public String getDeviceStateName() {
return deviceStateName;
}
public void setDeviceStateName(String deviceStateName) {
this.deviceStateName = deviceStateName;
}
}
public enum status {
ACTIVE,
INACTIVE
}
Convert Set to array and convert array to list
Set
Arrays.asList(Ids.toArray())
Enum Class :
public enum DeviceStates {
SHIPPED ("SHIPPED", 1),
INSTALLED_NOT_REPORTING("INSTALLED_NOT_REPORTING", 2),
NWKDESIGNED_NOT_REPORTING("NWKDESIGNED_NOT_REPORTING", 3),
NOT_INSTALLED_REPORTING("NOT_INSTALLED_REPORTING", 4),
NOT_DESIGNED_REPORTING("NOT_DESIGNED_REPORTING", 5),
REPORTING("REPORTING", 6),
RMA("RMA", 7),
SCRAPPED("SCRAPPED", 8);
private long deviceStateId;
private String deviceStateName;
public long getDeviceStateId() {
return deviceStateId;
}
DeviceStates(String deviceStateName, long deviceStateId) {
this.deviceStateId = deviceStateId;
this.deviceStateName = deviceStateName;
}
public String getDeviceStateName() {
return deviceStateName;
}
public void setDeviceStateName(String deviceStateName) {
this.deviceStateName = deviceStateName;
}
}
public enum status {
ACTIVE,
INACTIVE
}
No comments :
Post a Comment