You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@eventmesh.apache.org by "Alonexc (via GitHub)" <gi...@apache.org> on 2023/03/17 01:54:41 UTC

[GitHub] [incubator-eventmesh] Alonexc opened a new issue, #3481: [Enhancement] Replace this "Map.containsKey()" with a call to "Map.computeIfAbsent()".

Alonexc opened a new issue, #3481:
URL: https://github.com/apache/incubator-eventmesh/issues/3481

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/eventmesh/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Enhancement Request
   
   ![image](https://user-images.githubusercontent.com/91315508/225791716-1083ca39-334f-4c6a-a7cd-8869b278cfe6.png)
   located at:
   eventmesh-webhook/eventmesh-webhook-api/src/main/java/org/apache/eventmesh/webhook/api/Manufacturer.java line 57
   analysis and explanation:
   It’s a common pattern to test the result of a java.util.Map.get() against null or calling java.util.Map.containsKey() before proceeding with adding or changing the value in the map. However the java.util.Map API offers a significantly better alternative in the form of the computeIfPresent() and computeIfAbsent() methods. Using these instead leads to cleaner and more readable code.
   
   
   ### Describe the solution you'd like
   
   ![image](https://user-images.githubusercontent.com/91315508/225791753-446f1442-be36-4512-b94f-f5b182db4f0e.png)
   
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


[GitHub] [eventmesh] sumitdethe27 commented on issue #3481: [Enhancement] Replace this "Map.containsKey()" with a call to "Map.computeIfAbsent()".

Posted by "sumitdethe27 (via GitHub)" <gi...@apache.org>.
sumitdethe27 commented on issue #3481:
URL: https://github.com/apache/eventmesh/issues/3481#issuecomment-1583027217

   Hey @Alonexc ,
   is this issue available, I would like to work on it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


[GitHub] [eventmesh] sumitdethe27 commented on issue #3481: [Enhancement] Replace this "Map.containsKey()" with a call to "Map.computeIfAbsent()".

Posted by "sumitdethe27 (via GitHub)" <gi...@apache.org>.
sumitdethe27 commented on issue #3481:
URL: https://github.com/apache/eventmesh/issues/3481#issuecomment-1585448797

   Hey
   is this issue available, I would like to work on it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


[GitHub] [eventmesh] Alonexc commented on issue #3481: [Enhancement] Replace this "Map.containsKey()" with a call to "Map.computeIfAbsent()".

Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on issue #3481:
URL: https://github.com/apache/eventmesh/issues/3481#issuecomment-1501494074

   @garimellasrisudha You are very welcome to pr.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [I] [Enhancement] Replace this "Map.containsKey()" with a call to "Map.computeIfAbsent()". (eventmesh)

Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc closed issue #3481: [Enhancement] Replace this "Map.containsKey()" with a call to "Map.computeIfAbsent()".
URL: https://github.com/apache/eventmesh/issues/3481


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


[GitHub] [eventmesh] garimellasrisudha commented on issue #3481: [Enhancement] Replace this "Map.containsKey()" with a call to "Map.computeIfAbsent()".

Posted by "garimellasrisudha (via GitHub)" <gi...@apache.org>.
garimellasrisudha commented on issue #3481:
URL: https://github.com/apache/eventmesh/issues/3481#issuecomment-1501409073

   Hi Alonexc,
   Is it still available?
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [I] [Enhancement] Replace this "Map.containsKey()" with a call to "Map.computeIfAbsent()". (eventmesh)

Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on issue #3481:
URL: https://github.com/apache/eventmesh/issues/3481#issuecomment-1596368402

   @sumitdethe27 This issue has been fixed and I will be closing this it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org