blob: d17baf663ddc9bf96c777c8751075c2a6023f622 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query;
/**
* @author Arne Bergene Fossaa
*/
class QueryHelper {
/** Compares two objects which may be null */
public static boolean equals(Object a,Object b) {
if (a == null) return b == null;
return a.equals(b);
}
/**
* Helper method that finds the hashcode for a group of objects.
* Inspired by java.util.List
*/
public static int combineHash(Object... objs) {
int hash = 1;
for (Object o:objs) {
hash = 31*hash + (o == null ? 0 : o.hashCode());
}
return hash;
}
}
|