1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.databoard.example;
\r
14 import org.simantics.databoard.Bindings;
\r
15 import org.simantics.databoard.binding.Binding;
\r
16 import org.simantics.databoard.binding.error.BindingException;
\r
18 public class DeepHashcode {
\r
20 public static void main(String[] args) throws BindingException {
\r
22 // Binding can calculate deep hashcode for any instance
\r
23 Binding binding = Bindings.getBindingUnchecked( int[].class );
\r
25 int[] array1 = new int[] { 1, 2, 3 };
\r
26 int[] array2 = new int[] { 1, 2, 3 };
\r
27 int[] array3 = new int[] { 2, 3, 4 };
\r
29 System.out.println( "Hashcode for array1 is " + binding.hashValue( array1 ) );
\r
30 System.out.println( "Hashcode for array2 is " + binding.hashValue( array2 ) );
\r
31 System.out.println( "Hashcode for array3 is " + binding.hashValue( array3 ) );
\r