Java Hazelcast无法对IList进行排序
我正在尝试使用以下代码对Hazelcast IList进行排序 类付费频道条目Java Hazelcast无法对IList进行排序,java,list,hazelcast,Java,List,Hazelcast,我正在尝试使用以下代码对Hazelcast IList进行排序 类付费频道条目 public class PaymentChannelEntry implements Serializable { private static final long serialVersionUID = 5416475057971472127L; private Long executionTimestamp; // timestamp of the time of the transactio
public class PaymentChannelEntry implements Serializable {
private static final long serialVersionUID = 5416475057971472127L;
private Long executionTimestamp; // timestamp of the time of the transaction in Zulu time zone (UTC)
private BigDecimal transactionAmount; // The amount of the transaction that contributes to the associated payment channel
public PaymentChannelEntry(Long executionTimestamp, BigDecimal transactionAmount) {
this.executionTimestamp = executionTimestamp;
this.transactionAmount = transactionAmount;
}
public Long getExecutionTimestamp() {
return executionTimestamp;
}
public void setExecutionTimestamp(Long executionTimestamp) {
this.executionTimestamp = executionTimestamp;
}
public BigDecimal getTransactionAmount() {
return transactionAmount;
}
public void setTransactionAmount(BigDecimal transactionAmount) {
this.transactionAmount = transactionAmount;
}
}
然后我从Hazelcast IList中选择PaymentChannelEntry列表
IList<PaymentChannelEntry> entryIList = channelStore.getChannelEntryList(channelData.getType())
任何解决方案都将不胜感激
谢谢。似乎是由
channelStore返回的列表。getChannelEntryList
不可修改,因此出现异常
如果无法修改返回的内容,请先复制,然后排序:
// example
IList<PaymentChannelEntry> result = new ArrayList<>(channelStore.getChannelEntryList(channelData.getType()));
// now sort the list
//示例
IList result=newArrayList(channelStore.getChannelEntryList(channelData.getType());
//现在对列表进行排序
以上只是一个示例,可能无法编译,但最终需要将从channelStore.getChannelEntryList(channelData.getType())
返回的内容复制到一个可变列表中,然后对其进行排序
// example
IList<PaymentChannelEntry> result = new ArrayList<>(channelStore.getChannelEntryList(channelData.getType()));
// now sort the list