Here you can find the source of create(final String uri)
Parameter | Description |
---|---|
uri | the uri |
public static URI create(final String uri)
//package com.java2s; /*//from w w w. j a va2 s . co m * Copyright: Almende B.V. (2014), Rotterdam, The Netherlands * License: The Apache Software License, Version 2.0 */ import java.lang.ref.WeakReference; import java.net.URI; import java.util.HashMap; import java.util.Map; public class Main { private static final Map<String, WeakReference<URI>> uris = new HashMap<String, WeakReference<URI>>(100); /** * Creates or obtains a new URI;. * * @param uri * the uri * @return the uri */ public static URI create(final String uri) { final WeakReference<URI> ref = uris.get(uri); if (ref != null) { final URI res = ref.get(); if (res != null) { return res; } } final URI newUri = URI.create(uri.intern()); uris.put(uri, new WeakReference<URI>(newUri)); return newUri; } }