Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2008 flowr.org - all rights reserved. This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License (EPL) v1.0. The EPL is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors: flowr.org - initial API and implementation
 ******************************************************************************/

import java.util.Comparator;

public class Main {
    public static <T> Comparator<T> identityComparator() {
        return new Comparator<T>() {

            @Override
            public int compare(T o1, T o2) {
                return System.identityHashCode(o1) - System.identityHashCode(o2);
            }
        };
    }
}