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   * @param <D> Type of the fourth element
16   */
17  @ThreadSafe
18  public class Quartet<A, B, C, D> {
19  
20      private final A a;
21      private final B b;
22      private final C c;
23      private final D d;
24  
25      /**
26       * Create a quartet and store four objects.
27       *
28       * @param a the first object to store
29       * @param b the second object to store
30       * @param c the third object to store
31       * @param d the fourth object to store
32       */
33      public Quartet(A a, B b, C c, D d) {
34          this.a = a;
35          this.b = b;
36          this.c = c;
37          this.d = d;
38      }
39  
40      /**
41       * Returns the first stored object.
42       *
43       * @return first object stored
44       */
45      public final A getA() {
46          return a;
47      }
48  
49      /**
50       * Returns the second stored object.
51       *
52       * @return second object stored
53       */
54      public final B getB() {
55          return b;
56      }
57  
58      /**
59       * Returns the third stored object.
60       *
61       * @return third object stored
62       */
63      public final C getC() {
64          return c;
65      }
66  
67      /**
68       * Returns the fourth stored object.
69       *
70       * @return fourth object stored
71       */
72      public final D getD() {
73          return d;
74      }
75  }