Here you can find the source of getDuplicacy(ResultSet rs)
public static boolean getDuplicacy(ResultSet rs) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static boolean getDuplicacy(ResultSet rs) throws SQLException { int cc = rs.getMetaData().getColumnCount(); int j = 1; String prev = null;/* w w w. j a va2 s. c om*/ String next; while (j <= cc) { if (j > 1) prev = rs.getString(j - 1); next = rs.getString(j); if (null != prev && prev.equals(next)) return true; j++; } return false; } }