Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2011 Freescale Semiconductor. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Serge Beauchamp (Freescale Semiconductor) - initial API and implementation *******************************************************************************/ import java.util.HashMap; public class Main { private static String getString(HashMap<String, String> stringTable, String string) { String result = stringTable.get(string); if (result == null) { stringTable.put(string, string); result = string; } return result; } }