diff --git a/core/lib/Drupal/Core/Datetime/Element/Datelist.php b/core/lib/Drupal/Core/Datetime/Element/Datelist.php
index 59177e7..2e24a58 100644
--- a/core/lib/Drupal/Core/Datetime/Element/Datelist.php
+++ b/core/lib/Drupal/Core/Datetime/Element/Datelist.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\Core\Datetime\Element;
 
-use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Datetime\DateHelper;
 use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\Core\Form\FormStateInterface;
@@ -301,7 +300,7 @@ public static function processDatelist(&$element, FormStateInterface $form_state
    */
   public static function validateDatelist(&$element, FormStateInterface $form_state, &$complete_form) {
     $input_exists = FALSE;
-    $input = NestedArray::getValue($form_state->getValues(), $element['#parents'], $input_exists);
+    $input = $form_state->getValueForElement($element, $input_exists);
     if ($input_exists) {
       $all_empty = static::checkEmptyInputs($input, $element['#date_part_order']);
 
diff --git a/core/lib/Drupal/Core/Datetime/Element/Datetime.php b/core/lib/Drupal/Core/Datetime/Element/Datetime.php
index d005475..d2949b4 100644
--- a/core/lib/Drupal/Core/Datetime/Element/Datetime.php
+++ b/core/lib/Drupal/Core/Datetime/Element/Datetime.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\Core\Datetime\Element;
 
-use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Datetime\DrupalDateTime;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Datetime\Entity\DateFormat;
@@ -328,7 +327,7 @@ public static function processDatetime(&$element, FormStateInterface $form_state
    */
   public static function validateDatetime(&$element, FormStateInterface $form_state, &$complete_form) {
     $input_exists = FALSE;
-    $input = NestedArray::getValue($form_state->getValues(), $element['#parents'], $input_exists);
+    $input = $form_state->getValueForElement($element, $input_exists);
     if ($input_exists) {
 
       $title = !empty($element['#title']) ? $element['#title'] : '';
diff --git a/core/lib/Drupal/Core/Form/FormStateDecoratorBase.php b/core/lib/Drupal/Core/Form/FormStateDecoratorBase.php
index c063666..f7b43e4 100644
--- a/core/lib/Drupal/Core/Form/FormStateDecoratorBase.php
+++ b/core/lib/Drupal/Core/Form/FormStateDecoratorBase.php
@@ -516,8 +516,8 @@ public function &getValues() {
   /**
    * {@inheritdoc}
    */
-  public function &getValue($key, $default = NULL) {
-    return $this->decoratedFormState->getValue($key, $default);
+  public function &getValue($key, $default = NULL, &$exists = NULL) {
+    return $this->decoratedFormState->getValue($key, $default, $exists);
   }
 
   /**
@@ -564,6 +564,13 @@ public function isValueEmpty($key)  {
   /**
    * {@inheritdoc}
    */
+  public function getValueForElement(array $element, &$exists = NULL) {
+    return $this->decoratedFormState->getValueForElement($element, $exists);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function setValueForElement(array $element, $value) {
     $this->decoratedFormState->setValueForElement($element, $value);
 
diff --git a/core/lib/Drupal/Core/Form/FormStateInterface.php b/core/lib/Drupal/Core/Form/FormStateInterface.php
index 43b2d8e..fb6b9de 100644
--- a/core/lib/Drupal/Core/Form/FormStateInterface.php
+++ b/core/lib/Drupal/Core/Form/FormStateInterface.php
@@ -293,11 +293,14 @@ public function &getValues();
    *   it will return $values['foo']['bar'].
    * @param mixed $default
    *   (optional) The default value if the specified key does not exist.
+   * @param bool $exists
+   *   (optional) If given, an already defined variable that is altered by
+   *   reference.
    *
    * @return mixed
    *   The value for the given key, or NULL.
    */
-  public function &getValue($key, $default = NULL);
+  public function &getValue($key, $default = NULL, &$exists = NULL);
 
   /**
    * Sets the submitted form values.
@@ -369,6 +372,27 @@ public function hasValue($key);
   public function isValueEmpty($key);
 
   /**
+   * Gets the form value that corresponds to a given form element.
+   *
+   * @param array $element
+   *   The form element that should have its value retrieved; in most cases you
+   *   can just pass in the element from the $form array, although the only
+   *   component that is actually used is '#parents'. If constructing yourself,
+   *   set $element['#parents'] to be an array giving the path through the form
+   *   array's keys to the element whose value you want to retrieve. For
+   *   instance, if you want to retrieve the value of $form['elem1']['elem2'],
+   *   which should be stored in $form_state->getValue(['elem1', 'elem2']), you
+   *   would set $element['#parents'] = ['elem1', 'elem2'].
+   * @param bool $exists
+   *   (optional) If given, an already defined variable that is altered by
+   *   reference.
+   *
+   * @return mixed
+   *   The value for the form element, if it exists, NULL otherwise.
+   */
+  public function getValueForElement(array $element, &$exists = NULL);
+
+  /**
    * Changes submitted form values during form validation.
    *
    * Use this function to change the submitted value of a form element in a form
diff --git a/core/lib/Drupal/Core/Form/FormStateValuesTrait.php b/core/lib/Drupal/Core/Form/FormStateValuesTrait.php
index 87f7d46..2e46774 100644
--- a/core/lib/Drupal/Core/Form/FormStateValuesTrait.php
+++ b/core/lib/Drupal/Core/Form/FormStateValuesTrait.php
@@ -21,7 +21,7 @@
   /**
    * Implements \Drupal\Core\Form\FormStateInterface::getValue()
    */
-  public function &getValue($key, $default = NULL) {
+  public function &getValue($key, $default = NULL, &$exists = NULL) {
     $exists = NULL;
     $value = &NestedArray::getValue($this->getValues(), (array) $key, $exists);
     if (!$exists) {
@@ -74,6 +74,13 @@ public function isValueEmpty($key) {
   }
 
   /**
+   * Implements \Drupal\Core\Form\FormStateInterface::getValueForElement()
+   */
+  public function getValueForElement(array $element, &$exists = NULL) {
+    return $this->getValue($element['#parents'], NULL, $exists);
+  }
+
+  /**
    * Implements \Drupal\Core\Form\FormStateInterface::setValueForElement()
    */
   public function setValueForElement(array $element, $value) {
diff --git a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
index 587a396..beaddd7 100644
--- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
+++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
@@ -367,7 +367,7 @@ public static function validateMultipleCount($element, FormStateInterface $form_
       $message = t('Field %field can only hold @max values but there were @count uploaded. The following files have been omitted as a result: %list.', $args);
       drupal_set_message($message, 'warning');
       $values['fids'] = array_slice($values['fids'], 0, $keep);
-      NestedArray::setValue($form_state->getValues(), $element['#parents'], $values);
+      $form_state->setValueForElement($element, $values);
     }
   }
 
diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php
index ab056f5..a1becb1 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\views\Plugin\views\query;
 
-use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Cache\Cache;
 use Drupal\Core\Database\Database;
 use Drupal\Core\Database\Query\Condition;
@@ -273,7 +272,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    */
   public function submitOptionsForm(&$form, FormStateInterface $form_state) {
     $element = ['#parents' => ['query', 'options', 'query_tags']];
-    $value = explode(',', NestedArray::getValue($form_state->getValues(), $element['#parents']));
+    $value = explode(',', $form_state->getValueForElement($element));
     $value = array_filter(array_map('trim', $value));
     $form_state->setValueForElement($element, $value);
   }
diff --git a/core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php b/core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php
index f5b2147..6acb96d 100644
--- a/core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php
+++ b/core/tests/Drupal/Tests/Core/Form/FormStateValuesTraitTest.php
@@ -13,6 +13,47 @@
 class FormStateValuesTraitTest extends UnitTestCase {
 
   /**
+   * @covers ::getValueForElement
+   *
+   * @dataProvider providerTestGetValueForElement
+   */
+  public function testGetValueForElement($set_data, $expected) {
+    $element = [
+      '#parents' => [
+        'foo',
+        'bar',
+      ],
+    ];
+    $value = $this->randomMachineName();
+
+    $input_exists = NULL;
+    $form_state = new FormStateValuesTraitStub();
+    if ($set_data) {
+      $form_state->setValue(['foo', 'bar'], $value);
+    }
+
+    $value_from_form_state = $form_state->getValueForElement($element, $input_exists);
+    if ($set_data) {
+      $this->assertSame($value, $value_from_form_state);
+    }
+    else {
+      $this->assertNull($value_from_form_state);
+    }
+    $this->assertSame($expected, $input_exists);
+  }
+
+  public function providerTestGetValueForElement() {
+    $data = [];
+    $data[] = [
+      FALSE, FALSE,
+    ];
+    $data[] = [
+      TRUE, TRUE,
+    ];
+    return $data;
+  }
+
+  /**
    * Tests that setting the value for an element adds to the values.
    *
    * @covers ::setValueForElement
