org.eclipse.rdf4j.query

## Class AbstractBindingSet

- java.lang.Object
- - org.eclipse.rdf4j.query.AbstractBindingSet

- All Implemented Interfaces:
    Serializable, Iterable<Binding>, BindingSet
  Direct Known Subclasses:
    ListBindingSet, MapBindingSet, QueryBindingSet, SPARQLQueryBindingSet

      public abstract class AbstractBindingSet
      extends Object
      implements BindingSet

  Abstract base class for `BindingSet` implementations, providing a.o. consistent implementations of `BindingSet.equals(Object)` and `BindingSet.hashCode()`.
  Author:
    Jeen Broekstra
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractBindingSet()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object other)` Compares a BindingSet object to another object.
    `int` | `hashCode()` The hash code of a binding is defined as the bit-wise XOR of the hash codes of its bindings:
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.query.BindingSet

      `getBinding, getBindingNames, getValue, hasBinding, iterator, size`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### AbstractBindingSet

          public AbstractBindingSet()

  - ### Method Detail

    - #### equals

          public boolean equals(Object other)

      Description copied from interface: `BindingSet`
      Compares a BindingSet object to another object.
      Specified by:
        `equals` in interface `BindingSet`
      Overrides:
        `equals` in class `Object`
      Parameters:
        `other` - The object to compare this binding to.
      Returns:
        `true` if the other object is an instance of `BindingSet` and it contains the same set of bindings (disregarding order), `false` otherwise.

    - #### hashCode

          public final int hashCode()

      Description copied from interface: `BindingSet`
      The hash code of a binding is defined as the bit-wise XOR of the hash codes of its bindings:

           int hashCode = 0;

           for (Binding binding : this) {
                  hashCode ˆ= binding.getName().hashCode() ˆ binding.getValue().hashCode();
           }

      Note: the calculated hash code intentionally does not depend on the order in which the bindings are iterated over.
      Specified by:
        `hashCode` in interface `BindingSet`
      Overrides:
        `hashCode` in class `Object`
      Returns:
        A hash code for the BindingSet.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.