Java 8 Functional Programming - Need to write a generic function on classJava inner class and static nested classDoes functional programming replace GoF design patterns?How do I generate random integers within a specific range in Java?How to create a generic array in Java?What is (functional) reactive programming?Functional programming vs Object Oriented programmingHow do I create a file and write to it in Java?How can a time function exist in functional programming?Static Classes In JavaWhat is the difference between canonical name, simple name and class name in Java Class?

How do I extract a value from a time formatted value in excel?

Would this custom Sorcerer variant that can only learn any verbal-component-only spell be unbalanced?

Sequence of Tenses: Translating the subjunctive

Why Were Madagascar and New Zealand Discovered So Late?

Term for the "extreme-extension" version of a straw man fallacy?

Return the Closest Prime Number

How does Loki do this?

Is there a problem with hiding "forgot password" until it's needed?

Why escape if the_content isnt?

Is a stroke of luck acceptable after a series of unfavorable events?

Valid Badminton Score?

A Rare Riley Riddle

Do the temporary hit points from the Battlerager barbarian's Reckless Abandon stack if I make multiple attacks on my turn?

Failed to fetch jessie backports repository

A problem in Probability theory

Is the destination of a commercial flight important for the pilot?

What is the opposite of 'gravitas'?

What can we do to stop prior company from asking us questions?

Do sorcerers' Subtle Spells require a skill check to be unseen?

Is there a korbon needed for conversion?

Replace character with another only if repeated and not part of a word

How to be diplomatic in refusing to write code that breaches the privacy of our users

How does the UK government determine the size of a mandate?

Applicability of Single Responsibility Principle



Java 8 Functional Programming - Need to write a generic function on class


Java inner class and static nested classDoes functional programming replace GoF design patterns?How do I generate random integers within a specific range in Java?How to create a generic array in Java?What is (functional) reactive programming?Functional programming vs Object Oriented programmingHow do I create a file and write to it in Java?How can a time function exist in functional programming?Static Classes In JavaWhat is the difference between canonical name, simple name and class name in Java Class?













3















I want to create a method that accepts something like this



set(nodeStatus, status, NodeStatus::setStatus, Status::valueOf);
set(nodeStatus, errorCode, NodeStatus::setErrorCode, ErrorCode::valueOf);


Status and ErrorCode are enums in java.



Signature and pseudocode



set(NodeStatus nodeStatus, byte[] status, ?nodeStatusOperator , ?ValueTransformer) 
1. convert byte[] status to appropriate value as per ValueTransformer
2. nodeStatusOperator sets this transformed value according to the lambda passed.



I want to know what method signature should be used to accompalish this in java and why. I tried various Consumers, BiConsumers etc but couldnt do this. Can anyone please help?










share|improve this question


























    3















    I want to create a method that accepts something like this



    set(nodeStatus, status, NodeStatus::setStatus, Status::valueOf);
    set(nodeStatus, errorCode, NodeStatus::setErrorCode, ErrorCode::valueOf);


    Status and ErrorCode are enums in java.



    Signature and pseudocode



    set(NodeStatus nodeStatus, byte[] status, ?nodeStatusOperator , ?ValueTransformer) 
    1. convert byte[] status to appropriate value as per ValueTransformer
    2. nodeStatusOperator sets this transformed value according to the lambda passed.



    I want to know what method signature should be used to accompalish this in java and why. I tried various Consumers, BiConsumers etc but couldnt do this. Can anyone please help?










    share|improve this question
























      3












      3








      3


      1






      I want to create a method that accepts something like this



      set(nodeStatus, status, NodeStatus::setStatus, Status::valueOf);
      set(nodeStatus, errorCode, NodeStatus::setErrorCode, ErrorCode::valueOf);


      Status and ErrorCode are enums in java.



      Signature and pseudocode



      set(NodeStatus nodeStatus, byte[] status, ?nodeStatusOperator , ?ValueTransformer) 
      1. convert byte[] status to appropriate value as per ValueTransformer
      2. nodeStatusOperator sets this transformed value according to the lambda passed.



      I want to know what method signature should be used to accompalish this in java and why. I tried various Consumers, BiConsumers etc but couldnt do this. Can anyone please help?










      share|improve this question














      I want to create a method that accepts something like this



      set(nodeStatus, status, NodeStatus::setStatus, Status::valueOf);
      set(nodeStatus, errorCode, NodeStatus::setErrorCode, ErrorCode::valueOf);


      Status and ErrorCode are enums in java.



      Signature and pseudocode



      set(NodeStatus nodeStatus, byte[] status, ?nodeStatusOperator , ?ValueTransformer) 
      1. convert byte[] status to appropriate value as per ValueTransformer
      2. nodeStatusOperator sets this transformed value according to the lambda passed.



      I want to know what method signature should be used to accompalish this in java and why. I tried various Consumers, BiConsumers etc but couldnt do this. Can anyone please help?







      java lambda functional-programming producer-consumer






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 13:09









      Nishant LakharaNishant Lakhara

      95131036




      95131036






















          2 Answers
          2






          active

          oldest

          votes


















          4














          As far as I can tell, what you need is this:



          public <T> void set (NodeStatus nodeStatus, 
          byte [] value,
          BiConsumer<NodeStatus,T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(nodeStatus, transformedValue);



          (If value can be something other than byte[], you can replace it with another type parameter.)



          P.s.: setter is a BiConsumer, because you use a static method reference (e.g. NodeStatus::setErrorCode) on an instance method, so the first argument of BiConsumer has to be the NodeStatus instance setErrorCode() will be called on.



          P.p.s: As pointed out by glglgl, you can potentially simplify your code to this:



          public <T> void set (byte [] value, 
          Consumer<T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(transformedValue);



          And call it like this:



          set(status, nodeStatus::setStatus, Status::valueOf);


          ...where nodeStatus is the instance of NodeStatus you want to manipulate.






          share|improve this answer




















          • 2





            OP didn't specify if that's allowed for him, but if so, I'd refine this to public <T> void set (byte [] value, Consumer<T> setter, Function<byte[],T> transformer) T transformedValue = transformer.apply(value); setter.accept(transformedValue); , including the status object into the setter method reference. The calls then be like set(status, nodeStatus::setStatus, Status::valueOf); set(errorCode, nodeStatus::setErrorCode, ErrorCode::valueOf);

            – glglgl
            Mar 7 at 13:20







          • 2





            @glglgl You're absolutely right, that would look a lot cleaner. I just went with the signature OP provided, but I'll edit my answer.

            – biziclop
            Mar 7 at 13:22











          • Thanks everyone - Such a quick response and excellent use of generics

            – Nishant Lakhara
            Mar 7 at 13:52


















          0














          It's a little unclear what you're trying to achieve. Why pass the NodeStatus and the function when you could just pass a function that works on that specific NodeStatus instance, e.g.:



          static <T> void set(byte[] status, Consumer<T> nodeStatusOperator, Function<String, T> transformer) 
          nodeStatusOperator.accept(transformer.apply(new String(status)));


          public static void main(String[] args)
          NodeStatus nodeStatus = new NodeStatus();
          byte[] status = new byte[0];
          set(status, nodeStatus::setStatus, Status::valueOf);
          set(status, nodeStatus::setErrorCode, ErrorCode::valueOf);



          And what does that genericity buy you over a more straightforward approach?



          nodeStatus.setStatus(Status.valueOf(new String(status)));
          nodeStatus.setErrorCode(ErrorCode.valueOf(new String(status)));





          share|improve this answer























          • new String(status) is common for all Enums. Similarly in my class there are multiple other setters like Date where conversion is different. Also there are string setters. Moreover I can apply some general checks on the transformed value for multiple setters of same type and thus reduce line of code. Example: nodeStatus.setUpdateTs(new Date(BinaryUtils.bytesToLong(updateTs))

            – Nishant Lakhara
            Mar 7 at 13:56











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55044589%2fjava-8-functional-programming-need-to-write-a-generic-function-on-class%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          As far as I can tell, what you need is this:



          public <T> void set (NodeStatus nodeStatus, 
          byte [] value,
          BiConsumer<NodeStatus,T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(nodeStatus, transformedValue);



          (If value can be something other than byte[], you can replace it with another type parameter.)



          P.s.: setter is a BiConsumer, because you use a static method reference (e.g. NodeStatus::setErrorCode) on an instance method, so the first argument of BiConsumer has to be the NodeStatus instance setErrorCode() will be called on.



          P.p.s: As pointed out by glglgl, you can potentially simplify your code to this:



          public <T> void set (byte [] value, 
          Consumer<T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(transformedValue);



          And call it like this:



          set(status, nodeStatus::setStatus, Status::valueOf);


          ...where nodeStatus is the instance of NodeStatus you want to manipulate.






          share|improve this answer




















          • 2





            OP didn't specify if that's allowed for him, but if so, I'd refine this to public <T> void set (byte [] value, Consumer<T> setter, Function<byte[],T> transformer) T transformedValue = transformer.apply(value); setter.accept(transformedValue); , including the status object into the setter method reference. The calls then be like set(status, nodeStatus::setStatus, Status::valueOf); set(errorCode, nodeStatus::setErrorCode, ErrorCode::valueOf);

            – glglgl
            Mar 7 at 13:20







          • 2





            @glglgl You're absolutely right, that would look a lot cleaner. I just went with the signature OP provided, but I'll edit my answer.

            – biziclop
            Mar 7 at 13:22











          • Thanks everyone - Such a quick response and excellent use of generics

            – Nishant Lakhara
            Mar 7 at 13:52















          4














          As far as I can tell, what you need is this:



          public <T> void set (NodeStatus nodeStatus, 
          byte [] value,
          BiConsumer<NodeStatus,T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(nodeStatus, transformedValue);



          (If value can be something other than byte[], you can replace it with another type parameter.)



          P.s.: setter is a BiConsumer, because you use a static method reference (e.g. NodeStatus::setErrorCode) on an instance method, so the first argument of BiConsumer has to be the NodeStatus instance setErrorCode() will be called on.



          P.p.s: As pointed out by glglgl, you can potentially simplify your code to this:



          public <T> void set (byte [] value, 
          Consumer<T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(transformedValue);



          And call it like this:



          set(status, nodeStatus::setStatus, Status::valueOf);


          ...where nodeStatus is the instance of NodeStatus you want to manipulate.






          share|improve this answer




















          • 2





            OP didn't specify if that's allowed for him, but if so, I'd refine this to public <T> void set (byte [] value, Consumer<T> setter, Function<byte[],T> transformer) T transformedValue = transformer.apply(value); setter.accept(transformedValue); , including the status object into the setter method reference. The calls then be like set(status, nodeStatus::setStatus, Status::valueOf); set(errorCode, nodeStatus::setErrorCode, ErrorCode::valueOf);

            – glglgl
            Mar 7 at 13:20







          • 2





            @glglgl You're absolutely right, that would look a lot cleaner. I just went with the signature OP provided, but I'll edit my answer.

            – biziclop
            Mar 7 at 13:22











          • Thanks everyone - Such a quick response and excellent use of generics

            – Nishant Lakhara
            Mar 7 at 13:52













          4












          4








          4







          As far as I can tell, what you need is this:



          public <T> void set (NodeStatus nodeStatus, 
          byte [] value,
          BiConsumer<NodeStatus,T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(nodeStatus, transformedValue);



          (If value can be something other than byte[], you can replace it with another type parameter.)



          P.s.: setter is a BiConsumer, because you use a static method reference (e.g. NodeStatus::setErrorCode) on an instance method, so the first argument of BiConsumer has to be the NodeStatus instance setErrorCode() will be called on.



          P.p.s: As pointed out by glglgl, you can potentially simplify your code to this:



          public <T> void set (byte [] value, 
          Consumer<T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(transformedValue);



          And call it like this:



          set(status, nodeStatus::setStatus, Status::valueOf);


          ...where nodeStatus is the instance of NodeStatus you want to manipulate.






          share|improve this answer















          As far as I can tell, what you need is this:



          public <T> void set (NodeStatus nodeStatus, 
          byte [] value,
          BiConsumer<NodeStatus,T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(nodeStatus, transformedValue);



          (If value can be something other than byte[], you can replace it with another type parameter.)



          P.s.: setter is a BiConsumer, because you use a static method reference (e.g. NodeStatus::setErrorCode) on an instance method, so the first argument of BiConsumer has to be the NodeStatus instance setErrorCode() will be called on.



          P.p.s: As pointed out by glglgl, you can potentially simplify your code to this:



          public <T> void set (byte [] value, 
          Consumer<T> setter,
          Function<byte[],T> transformer)
          T transformedValue = transformer.apply(value);
          setter.accept(transformedValue);



          And call it like this:



          set(status, nodeStatus::setStatus, Status::valueOf);


          ...where nodeStatus is the instance of NodeStatus you want to manipulate.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 7 at 13:24

























          answered Mar 7 at 13:13









          biziclopbiziclop

          41.7k126491




          41.7k126491







          • 2





            OP didn't specify if that's allowed for him, but if so, I'd refine this to public <T> void set (byte [] value, Consumer<T> setter, Function<byte[],T> transformer) T transformedValue = transformer.apply(value); setter.accept(transformedValue); , including the status object into the setter method reference. The calls then be like set(status, nodeStatus::setStatus, Status::valueOf); set(errorCode, nodeStatus::setErrorCode, ErrorCode::valueOf);

            – glglgl
            Mar 7 at 13:20







          • 2





            @glglgl You're absolutely right, that would look a lot cleaner. I just went with the signature OP provided, but I'll edit my answer.

            – biziclop
            Mar 7 at 13:22











          • Thanks everyone - Such a quick response and excellent use of generics

            – Nishant Lakhara
            Mar 7 at 13:52












          • 2





            OP didn't specify if that's allowed for him, but if so, I'd refine this to public <T> void set (byte [] value, Consumer<T> setter, Function<byte[],T> transformer) T transformedValue = transformer.apply(value); setter.accept(transformedValue); , including the status object into the setter method reference. The calls then be like set(status, nodeStatus::setStatus, Status::valueOf); set(errorCode, nodeStatus::setErrorCode, ErrorCode::valueOf);

            – glglgl
            Mar 7 at 13:20







          • 2





            @glglgl You're absolutely right, that would look a lot cleaner. I just went with the signature OP provided, but I'll edit my answer.

            – biziclop
            Mar 7 at 13:22











          • Thanks everyone - Such a quick response and excellent use of generics

            – Nishant Lakhara
            Mar 7 at 13:52







          2




          2





          OP didn't specify if that's allowed for him, but if so, I'd refine this to public <T> void set (byte [] value, Consumer<T> setter, Function<byte[],T> transformer) T transformedValue = transformer.apply(value); setter.accept(transformedValue); , including the status object into the setter method reference. The calls then be like set(status, nodeStatus::setStatus, Status::valueOf); set(errorCode, nodeStatus::setErrorCode, ErrorCode::valueOf);

          – glglgl
          Mar 7 at 13:20






          OP didn't specify if that's allowed for him, but if so, I'd refine this to public <T> void set (byte [] value, Consumer<T> setter, Function<byte[],T> transformer) T transformedValue = transformer.apply(value); setter.accept(transformedValue); , including the status object into the setter method reference. The calls then be like set(status, nodeStatus::setStatus, Status::valueOf); set(errorCode, nodeStatus::setErrorCode, ErrorCode::valueOf);

          – glglgl
          Mar 7 at 13:20





          2




          2





          @glglgl You're absolutely right, that would look a lot cleaner. I just went with the signature OP provided, but I'll edit my answer.

          – biziclop
          Mar 7 at 13:22





          @glglgl You're absolutely right, that would look a lot cleaner. I just went with the signature OP provided, but I'll edit my answer.

          – biziclop
          Mar 7 at 13:22













          Thanks everyone - Such a quick response and excellent use of generics

          – Nishant Lakhara
          Mar 7 at 13:52





          Thanks everyone - Such a quick response and excellent use of generics

          – Nishant Lakhara
          Mar 7 at 13:52













          0














          It's a little unclear what you're trying to achieve. Why pass the NodeStatus and the function when you could just pass a function that works on that specific NodeStatus instance, e.g.:



          static <T> void set(byte[] status, Consumer<T> nodeStatusOperator, Function<String, T> transformer) 
          nodeStatusOperator.accept(transformer.apply(new String(status)));


          public static void main(String[] args)
          NodeStatus nodeStatus = new NodeStatus();
          byte[] status = new byte[0];
          set(status, nodeStatus::setStatus, Status::valueOf);
          set(status, nodeStatus::setErrorCode, ErrorCode::valueOf);



          And what does that genericity buy you over a more straightforward approach?



          nodeStatus.setStatus(Status.valueOf(new String(status)));
          nodeStatus.setErrorCode(ErrorCode.valueOf(new String(status)));





          share|improve this answer























          • new String(status) is common for all Enums. Similarly in my class there are multiple other setters like Date where conversion is different. Also there are string setters. Moreover I can apply some general checks on the transformed value for multiple setters of same type and thus reduce line of code. Example: nodeStatus.setUpdateTs(new Date(BinaryUtils.bytesToLong(updateTs))

            – Nishant Lakhara
            Mar 7 at 13:56
















          0














          It's a little unclear what you're trying to achieve. Why pass the NodeStatus and the function when you could just pass a function that works on that specific NodeStatus instance, e.g.:



          static <T> void set(byte[] status, Consumer<T> nodeStatusOperator, Function<String, T> transformer) 
          nodeStatusOperator.accept(transformer.apply(new String(status)));


          public static void main(String[] args)
          NodeStatus nodeStatus = new NodeStatus();
          byte[] status = new byte[0];
          set(status, nodeStatus::setStatus, Status::valueOf);
          set(status, nodeStatus::setErrorCode, ErrorCode::valueOf);



          And what does that genericity buy you over a more straightforward approach?



          nodeStatus.setStatus(Status.valueOf(new String(status)));
          nodeStatus.setErrorCode(ErrorCode.valueOf(new String(status)));





          share|improve this answer























          • new String(status) is common for all Enums. Similarly in my class there are multiple other setters like Date where conversion is different. Also there are string setters. Moreover I can apply some general checks on the transformed value for multiple setters of same type and thus reduce line of code. Example: nodeStatus.setUpdateTs(new Date(BinaryUtils.bytesToLong(updateTs))

            – Nishant Lakhara
            Mar 7 at 13:56














          0












          0








          0







          It's a little unclear what you're trying to achieve. Why pass the NodeStatus and the function when you could just pass a function that works on that specific NodeStatus instance, e.g.:



          static <T> void set(byte[] status, Consumer<T> nodeStatusOperator, Function<String, T> transformer) 
          nodeStatusOperator.accept(transformer.apply(new String(status)));


          public static void main(String[] args)
          NodeStatus nodeStatus = new NodeStatus();
          byte[] status = new byte[0];
          set(status, nodeStatus::setStatus, Status::valueOf);
          set(status, nodeStatus::setErrorCode, ErrorCode::valueOf);



          And what does that genericity buy you over a more straightforward approach?



          nodeStatus.setStatus(Status.valueOf(new String(status)));
          nodeStatus.setErrorCode(ErrorCode.valueOf(new String(status)));





          share|improve this answer













          It's a little unclear what you're trying to achieve. Why pass the NodeStatus and the function when you could just pass a function that works on that specific NodeStatus instance, e.g.:



          static <T> void set(byte[] status, Consumer<T> nodeStatusOperator, Function<String, T> transformer) 
          nodeStatusOperator.accept(transformer.apply(new String(status)));


          public static void main(String[] args)
          NodeStatus nodeStatus = new NodeStatus();
          byte[] status = new byte[0];
          set(status, nodeStatus::setStatus, Status::valueOf);
          set(status, nodeStatus::setErrorCode, ErrorCode::valueOf);



          And what does that genericity buy you over a more straightforward approach?



          nodeStatus.setStatus(Status.valueOf(new String(status)));
          nodeStatus.setErrorCode(ErrorCode.valueOf(new String(status)));






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 13:24









          MikeFHayMikeFHay

          3,23032035




          3,23032035












          • new String(status) is common for all Enums. Similarly in my class there are multiple other setters like Date where conversion is different. Also there are string setters. Moreover I can apply some general checks on the transformed value for multiple setters of same type and thus reduce line of code. Example: nodeStatus.setUpdateTs(new Date(BinaryUtils.bytesToLong(updateTs))

            – Nishant Lakhara
            Mar 7 at 13:56


















          • new String(status) is common for all Enums. Similarly in my class there are multiple other setters like Date where conversion is different. Also there are string setters. Moreover I can apply some general checks on the transformed value for multiple setters of same type and thus reduce line of code. Example: nodeStatus.setUpdateTs(new Date(BinaryUtils.bytesToLong(updateTs))

            – Nishant Lakhara
            Mar 7 at 13:56

















          new String(status) is common for all Enums. Similarly in my class there are multiple other setters like Date where conversion is different. Also there are string setters. Moreover I can apply some general checks on the transformed value for multiple setters of same type and thus reduce line of code. Example: nodeStatus.setUpdateTs(new Date(BinaryUtils.bytesToLong(updateTs))

          – Nishant Lakhara
          Mar 7 at 13:56






          new String(status) is common for all Enums. Similarly in my class there are multiple other setters like Date where conversion is different. Also there are string setters. Moreover I can apply some general checks on the transformed value for multiple setters of same type and thus reduce line of code. Example: nodeStatus.setUpdateTs(new Date(BinaryUtils.bytesToLong(updateTs))

          – Nishant Lakhara
          Mar 7 at 13:56


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55044589%2fjava-8-functional-programming-need-to-write-a-generic-function-on-class%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved