View Example (Fixed).java
public boolean createPresent (long id) { | |
List<Employee> employees = employeeService.getAllEmployees(); //returns 500+ employees. | |
for (Employee employee : employees) { | |
//lots of business logic. | |
//more than 5 database calls | |
//calculations | |
//logging | |
entityManager.clear(); | |
} |
View Example.java
public boolean deleteCompany (long id) { | |
List<Employee> employees = employeeService.getAllEmployees(); //returns 500+ employees. | |
for (Employee employee : employees) { | |
//lots of business logic. | |
//more than 5 database calls | |
//calculations | |
//logging | |
} | |
} |
View MyClass.java
import java.util.Scanner; | |
class MyClass { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
System.out.println ("Please Enter First Value : "); | |
int a = in.nextInt(); | |
System.out.println ("Please Enter Second Value : "); | |
int b = in.nextInt(); | |
System.out.println ("Please Enter Third Value : "); |
View Employee (short).java
public Department getDepartment() { | |
if (this.department != null) { | |
if (this.department.getDepartmentHead() != null) { | |
this.department.setDepartmentHead(null) | |
} | |
} | |
return department; | |
} |
View error.log
java.lang.StackOverflowError: null | |
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.8.0_241] | |
at java.lang.ClassLoader.defineClass(Unknown Source) ~[na:1.8.0_241] | |
at java.security.SecureClassLoader.defineClass(Unknown Source) ~[na:1.8.0_241] | |
at java.net.URLClassLoader.defineClass(Unknown Source) ~[na:1.8.0_241] | |
at java.net.URLClassLoader.access$100(Unknown Source) ~[na:1.8.0_241] | |
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_241] | |
at java.net.URLClassLoader$1.run(Unknown Source) ~[na:1.8.0_241] | |
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_241] | |
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_241] |
View Employee.java
@Entity | |
@Table(name = AppTables.employee) | |
public class Employee { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = AppTables.employeeTable.id) | |
private long id; | |
@Column(name = AppTables.employeeTable.name) | |
private String name; |
View Department.java
@Entity | |
@Table(name = AppTables.department) | |
public class Department { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = AppTables.departmentTable.id) | |
private Long id; | |
@Column(name = AppTables.departmentTable.name) | |
private String name; |
View 1.swift
// | |
// main.swift | |
// Assignment1 | |
// | |
// Created by Hafizur Rahman on 29/7/19. | |
// Copyright © 2019 Hafizur Rahman. All rights reserved. | |
// | |
import Foundation | |
func countPairs (first : [Int], last : [Int], sum: Int ) -> Int { |