aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/lang/MutableLong.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-02-21 18:47:20 +0100
committerJon Bratseth <bratseth@oath.com>2018-02-21 18:47:20 +0100
commitacfdb9e6c61b9f8d065645a657c130bd2cb49c87 (patch)
treef98e707acaa41496d4d1277dd3535569f623f5a6 /vespajlib/src/main/java/com/yahoo/lang/MutableLong.java
parent31805b7b9640302067713ce05573d9d1e5c92f39 (diff)
Deduce correct concat type
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/lang/MutableLong.java')
-rw-r--r--vespajlib/src/main/java/com/yahoo/lang/MutableLong.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/lang/MutableLong.java b/vespajlib/src/main/java/com/yahoo/lang/MutableLong.java
new file mode 100644
index 00000000000..e0e4a0828a9
--- /dev/null
+++ b/vespajlib/src/main/java/com/yahoo/lang/MutableLong.java
@@ -0,0 +1,33 @@
+// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.lang;
+
+/**
+ * A mutable long
+ *
+ * @author bratseth
+ */
+public class MutableLong {
+
+ private long value;
+
+ public MutableLong(long value) {
+ this.value = value;
+ }
+
+ public long get() { return value; }
+
+ public void set(long value) { this.value = value; }
+
+ /** Adds the increment to the current value and returns the resulting value */
+ public long add(long increment) {
+ value += increment;
+ return value;
+ }
+
+ /** Adds the increment to the current value and returns the resulting value */
+ public long subtract(long increment) {
+ value -= increment;
+ return value;
+ }
+
+}