Here you can find the source of close(Iterator> iterator)
public static void close(Iterator<?> iterator)
//package com.java2s; /*//from w w w . j a va 2 s. c o m * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2003-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import java.io.Closeable; import java.io.IOException; import java.util.Iterator; import java.util.logging.Level; import java.util.logging.Logger; public class Main { /** * Checks if the provided iterator implements {@link Closeable}. * <p> * Any problems are logged at {@link Level#FINE}. */ public static void close(Iterator<?> iterator) { if (iterator != null && iterator instanceof Closeable) { try { ((Closeable) iterator).close(); } catch (IOException e) { String name = iterator.getClass().getPackage().toString(); Logger log = Logger.getLogger(name); log.log(Level.FINE, e.getMessage(), e); } } } }