Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HBASE-14202 Reduce garbage we create.
- Loading branch information
1 parent
7d4de20
commit d49b1f6
Showing
17 changed files
with
166 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
hbase-common/src/main/java/org/apache/hadoop/hbase/util/ObjectIntPair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.hadoop.hbase.util; | ||
|
||
import org.apache.hadoop.hbase.classification.InterfaceAudience; | ||
|
||
/** | ||
* A generic class for pair of an Object and and a primitive int value. | ||
*/ | ||
@InterfaceAudience.Private | ||
public class ObjectIntPair<T> { | ||
|
||
private T first; | ||
private int second; | ||
|
||
public ObjectIntPair() { | ||
} | ||
|
||
public ObjectIntPair(T first, int second) { | ||
this.setFirst(first); | ||
this.setSecond(second); | ||
} | ||
|
||
public T getFirst() { | ||
return first; | ||
} | ||
|
||
public void setFirst(T first) { | ||
this.first = first; | ||
} | ||
|
||
public int getSecond() { | ||
return second; | ||
} | ||
|
||
public void setSecond(int second) { | ||
this.second = second; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other instanceof ObjectIntPair && equals(first, ((ObjectIntPair<?>) other).first) | ||
&& (this.second == ((ObjectIntPair<?>) other).second); | ||
} | ||
|
||
private static boolean equals(Object x, Object y) { | ||
return (x == null && y == null) || (x != null && x.equals(y)); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return first == null ? 0 : (first.hashCode() * 17) + 13 * second; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "{" + getFirst() + "," + getSecond() + "}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.