View Javadoc
1   /*
2    * Copyright 2020-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.util.tuples;
6   
7   import oshi.annotation.concurrent.ThreadSafe;
8   
9   /**
10   * Convenience class for returning multiple objects from methods.
11   *
12   * @param <A> Type of the first element
13   * @param <B> Type of the second element
14   * @param <C> Type of the third element
15   */
16  @ThreadSafe
17  public class Triplet<A, B, C> {
18  
19      private final A a;
20      private final B b;
21      private final C c;
22  
23      /**
24       * Create a triplet and store three objects.
25       *
26       * @param a the first object to store
27       * @param b the second object to store
28       * @param c the third object to store
29       */
30      public Triplet(A a, B b, C c) {
31          this.a = a;
32          this.b = b;
33          this.c = c;
34      }
35  
36      /**
37       * Returns the first stored object.
38       *
39       * @return first object stored
40       */
41      public final A getA() {
42          return a;
43      }
44  
45      /**
46       * Returns the second stored object.
47       *
48       * @return second object stored
49       */
50      public final B getB() {
51          return b;
52      }
53  
54      /**
55       * Returns the third stored object.
56       *
57       * @return third object stored
58       */
59      public final C getC() {
60          return c;
61      }
62  }