question: public < T > T checkSynapses ( SynapseParameterGetter < T > check , Polarity polarity ) { Collection < Synapse > synapses ; Synapse prototype ; if ( Polarity . EXCITATORY == polarity ) { synapses = exSynapseSet ; prototype = excitatoryPrototype ; if ( useGroupLevelSettings || synapses . isEmpty ( ) ) { return check . getParameterFromSynapse ( prototype ) ; } } else if ( Polarity . INHIBITORY == polarity ) { synapses = inSynapseSet ; prototype = inhibitoryPrototype ; if ( useGroupLevelSettings || synapses . isEmpty ( ) ) { return check . getParameterFromSynapse ( prototype ) ; } } else { synapses = getAllSynapses ( ) ; if ( synapses . isEmpty ( ) ) { return null ; } } Iterator < Synapse > synIter = synapses . iterator ( ) ; T first = check . getParameterFromSynapse ( synIter . next ( ) ) ; while ( synIter . hasNext ( ) ) { if ( ! first . equals ( check . getParameterFromSynapse ( synIter . next ( ) ) ) ) { return null ; } } return first ; }
target:  A generic method which takes in a functional interface and a polarity. It then performs that function on every synapse in the set(s) corresponding to the polarity parameter and returns a result matching the type specified by the passed function.