https://www.pubnub.com/tutorials/android/getting-started/
实时推送平台,用于创建即时聊天
compile group: 'com.google.guava', name: 'guava', version: '19.0'
compile group: 'joda-time', name: 'joda-time', version: '2.9.4'
代码:
public static String getTimeStampUtc() {
return DateTime.now(DateTimeZone.UTC).toString(ISODateTimeFormat.dateTime());
}
public static String getTimeStampUtc(long instant) {
return ISODateTimeFormat.dateTime().withZoneUTC().print(instant);
}
toString
@Override
public String toString() {
return MoreObjects.toStringHelper(MultiPojo.class)
.add("channel", channel)
.add("sender", sender)
.add("message", message)
.add("timestamp", timestamp)
.toString();
}
判断是否同相同
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (obj == this) {
return true;
}
if (this.getClass() != obj.getClass()) {
return false;
}
final MultiPojo other = (MultiPojo) obj;
return Objects.equal(this.channel, other.channel)
&& Objects.equal(this.sender, other.sender)
&& Objects.equal(this.message, other.message)
&& Objects.equal(this.timestamp, other.timestamp);
}
获取hashcode
public int hashCode() {
return Objects.hashCode(channel, sender, message, timestamp);
}






网友评论