001 /* 002 // $Id: //open/mondrian/src/main/mondrian/olap/fun/ArrayHolder.java#1 $ 003 // This software is subject to the terms of the Common Public License 004 // Agreement, available at the following URL: 005 // http://www.opensource.org/licenses/cpl.html. 006 // Copyright (C) 2007-2007 Julian Hyde 007 // All Rights Reserved. 008 // You must accept the terms of that agreement to use this software. 009 */ 010 package mondrian.olap.fun; 011 012 import java.util.Arrays; 013 014 /** 015 * Holds an array, so that {@link #equals} and {@link #hashCode} work. 016 * 017 * @author jhyde 018 * @version $Id: //open/mondrian/src/main/mondrian/olap/fun/ArrayHolder.java#1 $ 019 */ 020 public class ArrayHolder<T> { 021 private final T[] a; 022 023 ArrayHolder(T[] a) { 024 this.a = a; 025 } 026 027 public int hashCode() { 028 return Arrays.hashCode(a); 029 } 030 031 public boolean equals(Object o) { 032 return o instanceof ArrayHolder && 033 Arrays.equals(a, ((ArrayHolder) o).a); 034 } 035 } 036 037 // End ArrayHolder.java