diff options
author | Grant Limberg <glimberg@gmail.com> | 2015-06-23 23:03:02 -0700 |
---|---|---|
committer | Grant Limberg <glimberg@gmail.com> | 2015-06-23 23:03:02 -0700 |
commit | 759d71037ef429c0277d8bebe16cc4ac1f426c45 (patch) | |
tree | 0ecc5f5b6116a8d99918ccb83c25fe10a496f023 /java/src/com/zerotier/sdk | |
parent | adf89901c4d2de0d2338889a7fa1e5df1ab6b9be (diff) | |
download | infinitytier-759d71037ef429c0277d8bebe16cc4ac1f426c45.tar.gz infinitytier-759d71037ef429c0277d8bebe16cc4ac1f426c45.zip |
added Comparable interface to VirtualNetworkConfig so we can sort arrays containing it.
Diffstat (limited to 'java/src/com/zerotier/sdk')
-rw-r--r-- | java/src/com/zerotier/sdk/VirtualNetworkConfig.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/java/src/com/zerotier/sdk/VirtualNetworkConfig.java b/java/src/com/zerotier/sdk/VirtualNetworkConfig.java index 980f48f7..278fafd2 100644 --- a/java/src/com/zerotier/sdk/VirtualNetworkConfig.java +++ b/java/src/com/zerotier/sdk/VirtualNetworkConfig.java @@ -27,11 +27,13 @@ package com.zerotier.sdk; +import java.lang.Comparable; +import java.lang.Override; import java.lang.String; import java.util.ArrayList; import java.net.InetSocketAddress; -public final class VirtualNetworkConfig { +public final class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> { public static final int MAX_MULTICAST_SUBSCRIPTIONS = 4096; public static final int ZT1_MAX_ZT_ASSIGNED_ADDRESSES = 16; @@ -80,6 +82,14 @@ public final class VirtualNetworkConfig { aaEqual; } + public int compareTo(VirtualNetworkConfig cfg) { + if(cfg.nwid == this.nwid) { + return 0; + } else { + return this.nwid > cfg.nwid ? 1 : -1; + } + } + /** * 64-bit ZeroTier network ID */ |