Generic Comparator Using Class Fields & Lambda Java
If you want suggestions for improvement, here is one:

The following code:

private static &lt;T&gt; Field getField(Class&lt;T&gt; clazz,String fieldName){
    Field field = null;
    try {
        field = clazz.getDeclaredField(fieldName);
    }catch(java.lang.NoSuchFieldException e){
        e.printStackTrace();
    }
    return field;
}


is best rewritten as follows:

private static &lt;T&gt; Field getField(Class&lt;T&gt; clazz,String fieldName) {
    try {
        return clazz.getDeclaredField(fieldName);
    }catch(java.lang.NoSuchFieldException e){
        throw new RuntimeException(e);
    }
}


The following code:

//Lambda comparator
Comparator&lt;T&gt; orderByComparator = (f1, f2) -&gt; {

    Comparable compA = null;
    Comparable compB = null;

    // getting fields from object f1,f2
    try {
        compA =(Comparable) field.get(f1);
        compB =(Comparable) field.get(f2);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

    // handling null comparators
    if(compA == null)
        return -1;
    else if(compB == null)
        return 1;

    return compA.compareTo(compB);
};


is best rewritten as follows:

Comparator&lt;T&gt; orderByComparator = (f1, f2) -&gt; {
    Comparable compA, compB;
    try {
        compA = (Comparable) field.get(f1);
        compB = (Comparable) field.get(f2);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e);
    }
    return Objects.compare(compA, compB, Comparator.naturalOrder());
};


in short:


lose the useless comments; a comment is only useful if it says something that is not immediately obvious by looking at the code
do not initialize variables to nonsensical values, because then the compiler will not warn you when you forget to assign something meaningful to them
if you do not know what to do with an exception, do not print a stack trace, throw a runtime exception instead.


Generics and lambdas have no impact on performance.