Re: svn commit: r1802655 - /ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1802655 - /ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

Deepak Dixit-3
Hi Arun,

I think its not typo, java8 provide type interface for generic class
instantiation, you must use the diamond <>

https://docs.oracle.com/javase/tutorial/java/generics/genTypeInference.html
{info}

 You can substitute the parameterized type of the constructor with an empty
set of type parameters (<>):

Map<String, List<String>> myMap = new HashMap<>();

Note that to take advantage of type inference during generic class
instantiation, you must use the diamond. I
{info}


Thanks & Regards
--
Deepak Dixit
www.hotwaxsystems.com
www.hotwax.co

On Sat, Jul 22, 2017 at 11:09 AM, <[hidden email]> wrote:

> Author: arunpatidar
> Date: Sat Jul 22 05:39:56 2017
> New Revision: 1802655
>
> URL: http://svn.apache.org/viewvc?rev=1802655&view=rev
> Log:
> Fixed typo and added types with map object initialisation. (OFBIZ-8462).
> Thanks Swapnil Mane for reporting.
>
> Modified:
>     ofbiz/ofbiz-framework/trunk/applications/accounting/src/
> main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
>
> Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/
> main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
> applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/
> InvoiceServices.java?rev=1802655&r1=1802654&r2=1802655&view=diff
> ============================================================
> ==================
> --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/
> main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
> (original)
> +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/
> main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java Sat
> Jul 22 05:39:56 2017
> @@ -510,7 +510,7 @@ public class InvoiceServices {
>                      if (UtilValidate.isEmpty(shipmentItemBillings)) {
>
>                          // create the ShipmentItemBilling record
> -                        Map<String, Object> shipmentItemBillingCtx = new
> HashMap<>();
> +                        Map<String, Object> shipmentItemBillingCtx = new
> HashMap<String, Object>();
>                          shipmentItemBillingCtx.put("invoiceId",
> invoiceId);
>                          shipmentItemBillingCtx.put("invoiceItemSeqId",
> invoiceItemSeqId);
>                          shipmentItemBillingCtx.put("shipmentId",
> currentValue.get("shipmentId"));
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1802655 - /ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

taher
Interesting I didn't know that! Makes the code less verbose. If this is
safe to use then maybe it's better to adopt it in all the code base

On Jul 22, 2017 12:27 PM, "Deepak Dixit" <[hidden email]>
wrote:

> Hi Arun,
>
> I think its not typo, java8 provide type interface for generic class
> instantiation, you must use the diamond <>
>
> https://docs.oracle.com/javase/tutorial/java/generics/
> genTypeInference.html
> {info}
>
>  You can substitute the parameterized type of the constructor with an empty
> set of type parameters (<>):
>
> Map<String, List<String>> myMap = new HashMap<>();
>
> Note that to take advantage of type inference during generic class
> instantiation, you must use the diamond. I
> {info}
>
>
> Thanks & Regards
> --
> Deepak Dixit
> www.hotwaxsystems.com
> www.hotwax.co
>
> On Sat, Jul 22, 2017 at 11:09 AM, <[hidden email]> wrote:
>
> > Author: arunpatidar
> > Date: Sat Jul 22 05:39:56 2017
> > New Revision: 1802655
> >
> > URL: http://svn.apache.org/viewvc?rev=1802655&view=rev
> > Log:
> > Fixed typo and added types with map object initialisation. (OFBIZ-8462).
> > Thanks Swapnil Mane for reporting.
> >
> > Modified:
> >     ofbiz/ofbiz-framework/trunk/applications/accounting/src/
> > main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
> >
> > Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/
> > main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
> > URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
> > applications/accounting/src/main/java/org/apache/ofbiz/
> accounting/invoice/
> > InvoiceServices.java?rev=1802655&r1=1802654&r2=1802655&view=diff
> > ============================================================
> > ==================
> > --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/
> > main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
> > (original)
> > +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/
> > main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java Sat
> > Jul 22 05:39:56 2017
> > @@ -510,7 +510,7 @@ public class InvoiceServices {
> >                      if (UtilValidate.isEmpty(shipmentItemBillings)) {
> >
> >                          // create the ShipmentItemBilling record
> > -                        Map<String, Object> shipmentItemBillingCtx = new
> > HashMap<>();
> > +                        Map<String, Object> shipmentItemBillingCtx = new
> > HashMap<String, Object>();
> >                          shipmentItemBillingCtx.put("invoiceId",
> > invoiceId);
> >                          shipmentItemBillingCtx.put("invoiceItemSeqId",
> > invoiceItemSeqId);
> >                          shipmentItemBillingCtx.put("shipmentId",
> > currentValue.get("shipmentId"));
> >
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r1802655 - /ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

Nicolas Malin-2
Thanks Deepak for this. I can continue to be trust on intellij auto
suggest :)

Nicolas


Le 22/07/2017 à 11:33, Taher Alkhateeb a écrit :

> Interesting I didn't know that! Makes the code less verbose. If this is
> safe to use then maybe it's better to adopt it in all the code base
>
> On Jul 22, 2017 12:27 PM, "Deepak Dixit" <[hidden email]>
> wrote:
>
>> Hi Arun,
>>
>> I think its not typo, java8 provide type interface for generic class
>> instantiation, you must use the diamond <>
>>
>> https://docs.oracle.com/javase/tutorial/java/generics/
>> genTypeInference.html
>> {info}
>>
>>   You can substitute the parameterized type of the constructor with an empty
>> set of type parameters (<>):
>>
>> Map<String, List<String>> myMap = new HashMap<>();
>>
>> Note that to take advantage of type inference during generic class
>> instantiation, you must use the diamond. I
>> {info}
>>
>>
>> Thanks & Regards
>> --
>> Deepak Dixit
>> www.hotwaxsystems.com
>> www.hotwax.co
>>
>> On Sat, Jul 22, 2017 at 11:09 AM, <[hidden email]> wrote:
>>
>>> Author: arunpatidar
>>> Date: Sat Jul 22 05:39:56 2017
>>> New Revision: 1802655
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1802655&view=rev
>>> Log:
>>> Fixed typo and added types with map object initialisation. (OFBIZ-8462).
>>> Thanks Swapnil Mane for reporting.
>>>
>>> Modified:
>>>      ofbiz/ofbiz-framework/trunk/applications/accounting/src/
>>> main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
>>>
>>> Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/
>>> main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/
>>> applications/accounting/src/main/java/org/apache/ofbiz/
>> accounting/invoice/
>>> InvoiceServices.java?rev=1802655&r1=1802654&r2=1802655&view=diff
>>> ============================================================
>>> ==================
>>> --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/
>>> main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
>>> (original)
>>> +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/
>>> main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java Sat
>>> Jul 22 05:39:56 2017
>>> @@ -510,7 +510,7 @@ public class InvoiceServices {
>>>                       if (UtilValidate.isEmpty(shipmentItemBillings)) {
>>>
>>>                           // create the ShipmentItemBilling record
>>> -                        Map<String, Object> shipmentItemBillingCtx = new
>>> HashMap<>();
>>> +                        Map<String, Object> shipmentItemBillingCtx = new
>>> HashMap<String, Object>();
>>>                           shipmentItemBillingCtx.put("invoiceId",
>>> invoiceId);
>>>                           shipmentItemBillingCtx.put("invoiceItemSeqId",
>>> invoiceItemSeqId);
>>>                           shipmentItemBillingCtx.put("shipmentId",
>>> currentValue.get("shipmentId"));
>>>
>>>
>>>