Performance/Readability Improvement
<p><strong>Problem Statement:-</strong></p>

<p><strong>First Case:- Where inclusion and exclusion both are not empty so that  means inclusion overrides anything in exclusion so for that algorithm is like this</strong></p>

<pre><code>--If key is either equal to 155 or 156 and if temp is there in inclusion
  then go into that If Loop and do whatever you want. But If temp is not there
  in inclusion then don't do anything
</code></pre>

<p><strong>Second Case:- Where inclusion is null and exclusion is not null so that  means now you need to exclude everything present in exclusion string, so algo is like this</strong></p>

<pre><code> --If key is either equal to 155 or 156 and if temp is not there in
   exclusion then do whatever you want to do in that else loop otherwise don't
   do anything  
</code></pre>

<p><strong>Third Case:- If key is not equal to 155 or 156 then  do whatever you want
to do in that loop</strong></p>

<blockquote>
  <p>Is there any way we can improve this code in terms of performance,
  readability, accuracy? as when I see this it contains lot of if/else
  statements to make the above problem works</p>
</blockquote>

<p>P.S- Things that I am doing in each if/else loop is same everytime.</p>

<p>Cases1:- Where input parameters can be-</p>

<pre><code>String inclusion = null; // It can be null also
String exclusion = "100;77";

String temp = "0"; // It can change anytime
</code></pre>

<p>Cases2: Where input parameter can be-</p>

<pre><code>String inclusion = "0"; // It can be null also
String exclusion = null;

String temp = "0"; // It can change anytime
</code></pre>

<p>Below is the code in which above input parameters can be used.</p>

<pre><code>for(PdsxAttrKey key: pdsxWriteRequest.getAttrKeys()){

if((key.equals("156") || key.equals("155"))) {
    if(inclusion != null &amp;&amp; !inclusion.trim().isEmpty()) {
        if(inclusion.matches("(^|.*;)" + temp + "(;.*|$)")) {
            //Check the PdsxAttrValue has a Synthesizer
            if(metadata!=null){
                Synthesizer synthesizer = metadata.getSynthesizer();
                if(synthesizer!=null){
                    //Synthesize the attribute
                    PdsxAttrValue synthesizedVal = 
synthesizer.synthesize(key, record);
                    val = synthesizedVal;
                }
            }
            if(val!=null){
                writeRecord.getAttrs().put(key, val);
            }       
        }
    } else {
        if(!exclusion.matches("(^|.*;)" + temp + "(;.*|$)")) {
            //Check the PdsxAttrValue has a Synthesizer
            if(metadata!=null){
                Synthesizer synthesizer = metadata.getSynthesizer();
                if(synthesizer!=null){
                    //Synthesize the attribute
                    PdsxAttrValue synthesizedVal = 
synthesizer.synthesize(key, record);
                    //if(synthesizedVal!=null){
                    val = synthesizedVal;
                    //}
                }
            }
            if(val!=null){
                writeRecord.getAttrs().put(key, val);
            }
        }
    }
} else {
    //Check the PdsxAttrValue has a Synthesizer
    if(metadata!=null){
        Synthesizer synthesizer = metadata.getSynthesizer();
        if(synthesizer!=null){
            //Synthesize the attribute
            PdsxAttrValue synthesizedVal = synthesizer.synthesize(key, record);
            //if(synthesizedVal!=null){
            val = synthesizedVal;
            //}
        }
    }
    if(val!=null){
        writeRecord.getAttrs().put(key, val);
    }

}
</code></pre>

<p><strong>My question is as I mentioned above, is there any way we can improve this code in terms of performance as I have lot of if/else loops to solve the above problem?</strong></p>
