While it's not difficult to remove these unneeded lines manually, modern code editors support the removal of every unnecessary import with a single click from every file of the project.
=== Code examples
==== Noncompliant code example
[source,java,diff-id=1,diff-type=noncompliant]
----
package myapp.helpers;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.*; // Noncompliant - package is imported twice
import java.lang.Runnable; // Noncompliant - java.lang is imported by default
public class FileHelper {
public static String readFirstLine(String filePath) throws IOException {