Am trying to iterate an ArrayList using Java 8 - Lambda forEach and to store the value in the global variable. 

Am getting the error like `type mis-match` and am not able to typecast also.

Please see my code below.

```
Long product_id = listProducts.forEach(listproducts ->listproducts.getId());

```

My Previous approach : (without JAVA8 feature, now i want to change my code by using Java8)

```
 for(Product prod : listProducts)
        {
            product_id=prod.getId();
        }

```