title: I am new in java coding I had certain code which is duplicating below the details
body: <h1>service class details</h1>
  
  <pre><code>public ViewRoleInfo viewRoles(String roleDescription,Authentication authentication) {
      logger.info(Utility.ENTERED + new Object() {}.getClass().getEnclosingMethod().getName());
      viewRoleInfo = new ArrayList&lt;&gt;();
      veiwRoleDetials = new ViewRoleInfo();
      viewAllServices = new ArrayList&lt;&gt;();
      viewAllRoles = new ArrayList&lt;&gt;();
  
  
      List&lt;Jmrrole&gt; jmrrole = roleRepo.findViewRoles(roleDescription);
  
  
              jmrrole.stream().forEach(viewRoles -&gt;{
  
              viewAllServices.add(new ViewAllTransactions(viewRoles.getJmrtransactionm().getDescrption(),viewRoles.getAllowAuthorization(),viewRoles.getAllowInitiation(),viewRoles.getAllowView()));
              viewAllRoles.add(new ViewAllRoles( viewRoles.getJmrservicem().getDescription(),viewAllServices));
  
              viewRoleInfo.add(new ViewRoleInfo( viewRoles.getDescription(),viewRoles.getJmrdevicem().getNamdevice(),viewRoles.getCreatedby(),viewRoles.getDatcreated(),viewAllRoles));
  
              System.out.println(viewRoles.getDescription()+viewRoles.getJmrdevicem().getNamdevice()+viewRoles.getCreatedby()+viewRoles.getDatcreated()+viewAllRoles);
              veiwRoleDetials.setRoleDescription(viewRoles.getDescription());
              veiwRoleDetials.setChannel(viewRoles.getJmrdevicem().getNamdevice());
              veiwRoleDetials.setCreatedBy(viewRoles.getCreatedby());
              veiwRoleDetials.setCreatedOn(viewRoles.getDatcreated());
  
  
  
          });
          veiwRoleDetials.setViewAllRoles(viewAllRoles);
  
          return veiwRoleDetials;
  
  
  }}
  </code></pre>
  
  <h1>Below is the json output that is comming while executing</h1>
  
  <pre><code>http://path/path1/MCXcorpRole11
  {
  "errorStatus": false,
  "errorMsgs": [],
  "roleDescription": "MCXcorpRole11",
  "channel": "Mobile Browser",
  "createdBy": "superadmin",
  "createdOn": "2017-04-17",
  "viewAllRoles": [
  {
  "seriveName": "Transfer ",
  "viewAllTransactions": [
  {
  "transactionName": "Own Accoount Transfer",
  "allowAuthorization": "N",
  "allowInitiation": "Y",
  "allowView": "Y"
  },
  {
  "transactionName": "Vendor Payments",
  "allowAuthorization": "N",
  "allowInitiation": "Y",
  "allowView": "Y"
  },
  {
  "transactionName": "Bulk Registration",
  "allowAuthorization": "N",
  "allowInitiation": "Y",
  "allowView": "Y"
  },
  {
  "transactionName": "Mobile payment",
  "allowAuthorization": "Y",
  "allowInitiation": "N",
  "allowView": "N"
  }
  ]
  }    
  </code></pre>
  
  <h1>But in DB we have mapping as mention below</h1>
  
  <pre><code>"seriveName": "Transfer "
  is only mapped with 
  "transactionName": "Own Accoount Transfer"
  </code></pre>
  
  <h1>so I am expecting the output like this</h1>
  
  <pre><code>"roleDescription": "MCXcorpRole11",
  "channel": "Mobile Browser",
  "createdBy": "superadmin",
  "createdOn": "2017-04-17",
  "viewAllRoles": [
  {
  "seriveName": "Transfer ",
  "viewAllTransactions": [
  {
  "transactionName": "Own Accoount Transfer",
  "allowAuthorization": "N",
  "allowInitiation": "Y",
  "allowView": "Y"
  }]
  </code></pre>
  
  <h1>Can Someone figure it out where i did mistake here,Thanks in advance</h1>