Project

General

Profile

Actions

Feature #15198

closed

Array#intersect?

Added by c4am95 (Travis Hunter) over 5 years ago. Updated about 3 years ago.

Status:
Closed
Target version:
-
[ruby-core:89269]

Description

I frequently find myself needing to determine if two arrays intersect but not actually caring about the intersection, so I write code like:

(a1 & a2).any?

It would be nice to have an intersect? convenience method on Array to perform this query.

ruby#1972: Add Array#intersect?


Related issues 2 (1 open1 closed)

Related to Ruby master - Feature #16928: Array#include_all? & Array#include_any?OpenActions
Has duplicate Ruby master - Feature #15976: Add Array#overlap? for whether the intersection of 2 arrays is non empty?ClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0