Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/**
 * This file is licensed under the University of Illinois/NCSA Open Source License. See LICENSE.TXT for details.
 */

import java.util.Set;

public class Main {
    public static String getTheOnlyElementOf(Set<String> set) {
        if (set.size() != 1) {
            throw new RuntimeException("Expected a set of one element"); //$NON-NLS-1$
        }
        return set.toArray(new String[1])[0];
    }
}