diff --git a/core/lib/Drupal/Core/Datetime/Element/Datelist.php b/core/lib/Drupal/Core/Datetime/Element/Datelist.php
index 2caa4ca..8bdaf0a 100644
--- a/core/lib/Drupal/Core/Datetime/Element/Datelist.php
+++ b/core/lib/Drupal/Core/Datetime/Element/Datelist.php
@@ -7,7 +7,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;
@@ -300,7 +299,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 f9ccb45..ec068ff 100644
--- a/core/lib/Drupal/Core/Datetime/Element/Datetime.php
+++ b/core/lib/Drupal/Core/Datetime/Element/Datetime.php
@@ -7,7 +7,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;
@@ -333,7 +332,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/FormState.php b/core/lib/Drupal/Core/Form/FormState.php
index bd47f1e..5425bef 100644
--- a/core/lib/Drupal/Core/Form/FormState.php
+++ b/core/lib/Drupal/Core/Form/FormState.php
@@ -986,8 +986,7 @@ public function &getValues() {
   /**
    * {@inheritdoc}
    */
-  public function &getValue($key, $default = NULL) {
-    $exists = NULL;
+  public function &getValue($key, $default = NULL, &$exists = NULL) {
     $value = &NestedArray::getValue($this->getValues(), (array) $key, $exists);
     if (!$exists) {
       $value = $default;
@@ -1040,6 +1039,13 @@ public function isValueEmpty($key) {
   /**
    * {@inheritdoc}
    */
+  public function getValueForElement(array $element, &$exists = NULL) {
+    return $this->getValue($element['#parents'], NULL, $exists);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function setValueForElement(array $element, $value) {
     return $this->setValue($element['#parents'], $value);
   }
diff --git a/core/lib/Drupal/Core/Form/FormStateInterface.php b/core/lib/Drupal/Core/Form/FormStateInterface.php
index 11b089b..ebd2ec6 100644
--- a/core/lib/Drupal/Core/Form/FormStateInterface.php
+++ b/core/lib/Drupal/Core/Form/FormStateInterface.php
@@ -298,11 +298,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.
@@ -374,6 +377,11 @@ public function hasValue($key);
   public function isValueEmpty($key);
 
   /**
+   * @todo.
+   */
+  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/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
index acba472..7d9de57 100644
--- a/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
+++ b/core/modules/file/src/Plugin/Field/FieldWidget/FileWidget.php
@@ -354,7 +354,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 c481a85..da6c780 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -7,7 +7,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\Form\FormStateInterface;
@@ -241,7 +240,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    */
   public function submitOptionsForm(&$form, FormStateInterface $form_state) {
     $element = array('#parents' => array('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);
   }
