[Demonstration 1]

[Buggy Method]
public static void main(String[] args) {
    LinkedListAlgos algos = new LinkedListAlgos();
    int[] arr = { 1, 2, 3, 1, 2, 1, 1, 1, 1, 1, 5, 0, 1, 6 };
    LinkedlistNode<Integer> head = algos.constructLinkedListFromArray(arr);
    algos.printLinkedList(head);
    algos.removeDups(head);
    algos.printLinkedList(head);
}

[Buggy Hunk]
int [] arr = {1,2,3,1,2,1,1,1,1,1,5,0,1,6};

[Patch]
int [] arr = {1,1,1};

[Demonstration 2]

[Buggy Method]
@PreAuthorize("#oauth2.hasScope('write')")
@RequestMapping(method = RequestMethod.GET, value = "/my/banks/{bankId}/accounts", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public ResponseEntity<List<BankAccountOverviewBean>> getBankAccounts(@PathVariable("bankId") String bankId, Authentication auth) {
    ResponseEntity<List<BankAccountOverviewBean>> response;
    try {
        OAuth2Authentication oauth2 = (OAuth2Authentication) auth;
        String user = (String) auth.getPrincipal();
        ViewIdBean ownerView = new ViewIdBean();
        ownerView.setId(Constants.OWNER_VIEW);
        List<SubscriptionInfoBean> lstSib = sdao.getSubscriptionInfo(user, oauth2.getOAuth2Request().getClientId(), bankId);
        if (lstSib == null) {
            throw new IllegalAccessException(Constants.ERRMSG_NOT_SUBSCRIBED);
        }
        List<String> accountIds = new ArrayList<>();
        for (Iterator<SubscriptionInfoBean> iterator = lstSib.iterator(); iterator.hasNext(); ) {
            SubscriptionInfoBean s = iterator.next();
            if (validateSubscription(s, ownerView.getId())) {
                accountIds.add(s.getAccountId());
            }
        }
        List<BankAccountDetailsBean> ba = bad.getBankAccounts(user, bankId);
        List<BankAccountOverviewBean> accountList = null;
        BankAccountOverviewVisitor baoVisitor = new BankAccountOverviewVisitor();
        for (Iterator<BankAccountDetailsBean> iterator = ba.iterator(); iterator.hasNext(); ) {
            BankAccountDetailsBean b = iterator.next();
            if (!accountIds.isEmpty() && accountIds.contains(b.getId())) {
                b.registerVisitor(BankAccountOverviewBean.class.getName() + ":" + Constants.OWNER_VIEW, baoVisitor);
                if (accountList == null) {
                    accountList = new ArrayList<>();
                }
                accountList.add(b.getBankAccountOverview(Constants.OWNER_VIEW));
            }
        }
        response = ResponseEntity.ok(accountList);
    } catch (Exception ex) {
        logger.error(ex);
        response = ResponseEntity.badRequest().body(null);
    }
    return response;
}

[Buggy Hunk]
if (validateSubscription(s, ownerView.getId()))

[Patch]
if (validateSubscription(s, ownerView))

[Demonstration 3]

[Buggy Method]
private void stopRingtone() {
    if (mRingtone.isPlaying()) {
        mTestRingerButton.setText(R.string.start_test);
        mRingtone.stop();
        mNoiseMeter.stop();
        // removes all pending callbacks
        mHandler.removeCallbacks(null);
        mVolumeAdjuster.restoreVolume();
    }
}

[Buggy Hunk]
mHandler.removeCallbacks(null); // removes all pending callbacks

[Patch]
mHandler.removeCallbacks(mRunnable);