Easy handling of issue links with the help of a DefaultIssueLinkManager

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.link.DefaultIssueLinkManager;
import com.atlassian.jira.issue.Issue
 
def defaultIssueLinkManager = ComponentAccessor.getComponent(DefaultIssueLinkManager);
def issue = ComponentAccessor.getIssueManager().getIssueObject("PROJECT-1");
def sysUser = ComponentAccessor.getUserManager().getUserByName("admin");
 
//get all linked issues
def allLinkIssues = defaultIssueLinkManager.getLinkCollection(issue, sysUser).getAllIssues()
allLinkIssues instanceof ArrayList<Issue>
 
//get linked issues from linkedType and inward links
def issuesIn = defaultIssueLinkManager.getLinkCollection(issue, sysUser).getInwardIssues("LinkName")
issuesIn instanceof ArrayList<Issue>
 
//get linked issues from linkedType and outward links
def issuesOut = defaultIssueLinkManager.getLinkCollection(issue, sysUser).getOutwardIssues("LinkName")
issuesOut instanceof ArrayList<Issue>