Class KeyList

java.lang.Object
com.hedera.hashgraph.sdk.Key
com.hedera.hashgraph.sdk.KeyList
All Implemented Interfaces:
Iterable<Key>, Collection<Key>

public final class KeyList extends Key implements Collection<Key>
A list of keys that are required to sign in unison, with an optional threshold controlling how many keys of the list are required. See Hedera Documentation
  • Field Details

    • threshold

      @Nullable public Integer threshold
      The minimum number of keys that must sign.
  • Constructor Details

    • KeyList

      public KeyList()
      Create a new key list where all keys that are added will be required to sign.
  • Method Details

    • of

      public static KeyList of(Key... keys)
      List of keys in the key.
      Parameters:
      keys - the key / key list
      Returns:
      a list of the keys
    • withThreshold

      public static KeyList withThreshold(int threshold)
      Create a new key list where at least threshold keys must sign.
      Parameters:
      threshold - the minimum number of keys that must sign
      Returns:
      KeyList
    • fromProtobuf

      static KeyList fromProtobuf(KeyList keyList, @Nullable Integer threshold)
      Create key list from protobuf.
      Parameters:
      keyList - the key list
      threshold - the minimum number of keys that must sign
      Returns:
      the key list
    • getThreshold

      @Nullable public Integer getThreshold()
      Get the threshold for the KeyList.
      Returns:
      int
    • setThreshold

      public KeyList setThreshold(int threshold)
      Set a threshold for the KeyList.
      Parameters:
      threshold - the minimum number of keys that must sign
      Returns:
      KeyList
    • size

      public int size()
      Specified by:
      size in interface Collection<Key>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<Key>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<Key>
    • iterator

      public Iterator<Key> iterator()
      Specified by:
      iterator in interface Collection<Key>
      Specified by:
      iterator in interface Iterable<Key>
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection<Key>
    • toArray

      public <T> T[] toArray(T[] ts)
      Specified by:
      toArray in interface Collection<Key>
    • add

      public boolean add(Key key)
      Specified by:
      add in interface Collection<Key>
    • remove

      public boolean remove(Object o)
      Specified by:
      remove in interface Collection<Key>
    • containsAll

      public boolean containsAll(Collection<?> collection)
      Specified by:
      containsAll in interface Collection<Key>
    • addAll

      public boolean addAll(Collection<? extends Key> collection)
      Specified by:
      addAll in interface Collection<Key>
    • removeAll

      public boolean removeAll(Collection<?> collection)
      Specified by:
      removeAll in interface Collection<Key>
    • retainAll

      public boolean retainAll(Collection<?> collection)
      Specified by:
      retainAll in interface Collection<Key>
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<Key>
    • toProtobufKey

      Key toProtobufKey()
      Description copied from class: Key
      Serialize this key as a protobuf object
      Specified by:
      toProtobufKey in class Key
    • toProtobuf

      KeyList toProtobuf()
      Convert into protobuf representation.
      Returns:
      the protobuf representation
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Collection<Key>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<Key>
      Overrides:
      hashCode in class Object